Openshift: Restart pod when a secret changes

7/3/2018

I'd like to know if I could set up that a pod restarts when a secret is changed?

I'm using openshift 3.7.

-- Jordi
kubernetes
openshift

1 Answer

7/3/2018

There is currently no mechanism for this. You could mount the secret as a volume and watch the file for changes and kill the process when that happens, requiring you to bake in specific logic to your application. This is probably not the best idea.

Alternatively you could write a controller as a sidecar and watch for changes on the resource or take a look at https://github.com/mfojtik/k8s-trigger-controller

-- PhilipGough
Source: StackOverflow