question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SharedIndexInformer events not detecting Terminating state of a pod

See original GitHub issue

Is your enhancement related to a problem? Please describe

I need to detect when pod is entering “Terminating” state.

SharedInformerFactory factory = kubernetesClient.informers();
informer=factory.sharedIndexInformerFor(Pod.class, new OperationContext().withNamespace("ns"),10 * 1000L);
informer.addEventHandler(new ResourceEventHandler<Pod>() {...}

Delete event is triggered when pod is completely terminated, but I need when it begins the termination.

Describe the solution you’d like

n/a

Describe alternatives you’ve considered

No response

Additional context

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
shawkinscommented, Jan 11, 2022

See https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase - Terminating is not actually a phase:

Note: When a Pod is being deleted, it is shown as Terminating by some kubectl commands. This Terminating status is not one of the Pod phases. A Pod is granted a term to terminate gracefully, which defaults to 30 seconds. You can use the flag --force to terminate a Pod by force.

So you’ll need to instead check for the metadata.deletionTimestamp as an indication that the pod is terminating.

1reaction
shawkinscommented, Jan 10, 2022

Delete event is triggered when pod is completely terminated, but I need when it begins the termination.

You should check the pod status in onUpdate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pods stuck in Terminating status - kubernetes - Stack Overflow
If the pod is in a namespace other than default namespace then it is required to include -n <namespace-name> , otherwise above command...
Read more >
How to Debug Kubernetes Pending Pods and Scheduling ...
Learn how to debug Pending pods that fail to get scheduled due to resource constraints, taints, affinity rules, and other reasons.
Read more >
Introduction to Fabric8 Kubernetes Java Client Informer API
Informers use the Kubernetes API to learn about changes in the state of a Kubernetes ... SharedIndexInformer<Pod> podInformer = sharedInformerFactory.
Read more >
Determine the Reason for Pod Failure - Kubernetes
The termination message is intended to be brief final status, such as an assertion failure message. The kubelet truncates messages that are ...
Read more >
Release 4.8.12 - Release Status
Updating ose-aws-pod-identity-webhook images to be consistent with ART #141 ... Bug 1924728: Add warning events to vm status and changed appearance to be ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found