deleting pod with restartPolicy=Always

I started a busybox pod with restartPolicy=Always (default). How can I delete it now? K8S keeps restarting it (which is expected, I know...)

  • post-author-pic
    Fabio R

    kubectl delete -f filename.yaml

  • post-author-pic
    Will B

    This is probably due to a deployment. A lot of ways of creating a pod create a deployment behind the scenes, and if you delete the pod the deployment simply creates another one. Try this:

    kubectl get deployments
    You'll probably see a deployment for that pod. Then just delete the deployment with:
    kubectl delete deployment <deployment name>
    That will delete the deployment and the pod as well, and should stop re-creating the pod.

Looking For Team Training?

Learn More