Get list of all pods (including deleted) for kubernetes cluster? (AWS EKS)

10/16/2019

I need to do an audit of our AWS-managed kubernetes cluster (EKS). Specifically, I want to generate a list of all pods that were in a state of Running at some point.

Is there any functionality in kubectl that will get this information for me?

The cluster has been running for about 10 weeks.

-- James Wierzba
amazon-web-services
aws-eks
kubernetes

3 Answers

10/18/2019

Please execute:

$ kubectl get pods --all-namespaces | grep Running

This command will show you not only all pods in Running state but also namespaces where this pod have been deployed.

More information you can find here: kubectl-cheatsheet.

Please let me know if it helps.

-- MaggieO
Source: StackOverflow

10/18/2019

I found a complete history in AWS CloudWatch logs. You simply need to enable "Audit" logging in the "Logging" section of the EKS console.

See https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html for more info

-- James Wierzba
Source: StackOverflow

10/16/2019

I don't think you can get it from the pod itself, but you can do:

kubectl get events | grep Started
-- dmigo
Source: StackOverflow