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

9/5/2017

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

-- Here_2_learn
kubernetes
openshift
openshift-enterprise

1 Answer

9/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

-- luciddreamz
Source: StackOverflow