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.

Get pod restart count?

See original GitHub issue

I would like to get the number of times a certain pod has restarted. Is there any method in the k8 client that allows this? When we do kubectl get pods , there is a restart column that I am interested in. I see there is a restartCount for individual containers within a pod, but I am more interested in the pod level restart count.

thanks

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
shawkinscommented, May 25, 2022

@deod use the dsl to get a Pod (client.pods()…), then use pod.getStatus().getContainerStatuses().get(index).getRestartCount() - where index is the appropriate container index.

0reactions
stale[bot]commented, Oct 9, 2022

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

Read more comments on GitHub >

github_iconTop Results From Across the Web

kubernetes pod restart count shows inconsistent values when ...
RestartCount represents the number of times the container inside a pod has been restarted, it is based on the number of dead containers...
Read more >
How to alert for Pod Restart & OOMKilled in Kubernetes - Blog
We can use the pod container restart count in the last 1h and set the alert when it exceeds the threshold. 1 2,...
Read more >
How could I find the Kubernetes POD restart reasons
"When I say POD restart, it is getting deleted and created freshly" - So its not being restarted, it's being recreated.
Read more >
A Pod Restarts. So, What's Going on? | by Raju Dawadi
The 4th column shows the count of restart. The fifth pods has RESTARTS value of 2 means the pod was restarted twice in...
Read more >
Pod Lifecycle | Kubernetes
Whilst a Pod is running, the kubelet is able to restart containers to handle ... In the Kubernetes API, Pods have both a...
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