Change a file in running kubernestes pod without a restart of pod

5/16/2017

I'm trying to change log level in logback.xml (file) which is mounted in path (say A) using configmap inside pod from where it is linked to other path (say B) inside pod. It can be achieved by entering pod - path B and manually make changes. But I would like to know if there is other way. Is it possible to change file and update configmap so that it will reflect in pod? Or any other standard way?

-- Jasmitha
kubernetes

1 Answer

5/16/2017

You can map a ConfigMap for that. First, create a ConfigMap with a file entry:

https://kubernetes.io/docs/tasks/configure-pod-container/configmap/

Then you can mount that ConfigMap as a volume in your pod:

https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#adding-configmap-data-to-a-volume

When your ConfigMap changes, the file in your pod will change as well.

-- Oliver
Source: StackOverflow