- Newest
- Most votes
- Most comments
Hello,
With Kubernetes Jobs, when a Job completes, no more Pods are created, but the Pods are usually not deleted either. Keeping them around allows you to still view the logs of completed pods to check for errors, warnings, or other diagnostic output.
In EKS/Fargate the lifecyle of the Fargate node and costs are tied to the pod. As long as the pod is not removed the fargate node supporting it will be there. Given the pod is not deleted you are charged for it.
There are some tools in the Kubernetes ecosystem that can help with job cleanup. Some examples are below.
https://github.com/lwolf/kube-cleanup-operator
https://github.com/aramse/k8s-job-reaper
A fargate logging configuration should be leveraged to send the logs to a centralized location like Cloudwatch or OpenSearch before the pod is removed.
Hope that helps.
Kubectl get pods will show the pods associated with the job. Here's an example
kubectl get pods --selector=batch.kubernetes.io/job-name=examplejob
The documentation below outlines this.
https://kubernetes.io/docs/concepts/workloads/controllers/job/#running-an-example-job
Relevant content
- asked 2 years ago
- asked 2 months ago
- asked 2 years ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 months ago
Thanks for the answer! Could you confirm if "kubeutil get pods" no longer lists created pods from a job confirm the pods are all deleted? In other words, is there a way I can confirm all pods are deleted after a job completed.