How to delete a pod in Openshift with restart policy set to always?

Here_2_learn picture Here_2_learn · Sep 5, 2017 · Viewed 7.1k times · Source

Could be a basic one..

I have created a pod in Openshift Enterprise 3.2 with the configuration set as restartPolicy: Always . So ideally when the pod is destroyed Openshift will make sure to re-run/re-create the pod because of the restart policy.

Now I no longer need the pod. When I am trying to destroy the pod it is getting created again.

My question is What is the ideal way to destroy the pod with restartPolicy: Always

Answer

luciddreamz picture luciddreamz · Sep 5, 2017

The deployment config (and related replication controller) is the reason your pod is getting recreated when you delete it. The replication controller's job is literally to "ensure that a specified number of replicas of a pod are running at all times."

To destroy the pod (and leave the deployment config and other resources intact, just run: oc scale dc <dc-name> --replicas=0