decentralised, updatable configuration with kubernetes

2/17/2018

I need to keep some configuration maybe files or otehwrise in all instances of a kubernetes docker image deployment.

  1. I need the ability to remotely update the configuration in all of the running pods of the deployment. This is to be followed by invocation of some java code in all of the running pods of the docker image deployment.
  2. Whenever a new pod comes up of the same docker image deployment it should have the updated configuration.
  3. I dont want the configuration stored anywhere centrally as much as possible. Want it in each pod of the docker image deployment.

What are my choices?

As a last resort I could do it as a rolling deployment update.

R

-- Raster R
kubernetes

1 Answer

2/17/2018

Rolling deployment, or similar- update to a mounted config map, etc- is the kubernetes option. Always results in an application restart.

Having an application support live configuration updates, running some code after receiving those updates, without restart- that's an application feature.

Handwavy way of doing this-

  • Have the correct configuration live in a ConfigMap.

  • Have the application listen on a separate port for either a signal to retrieve updated configuration (if the application is k8s aware) or to actually receive the configuration bits themselves. Have the application be able to handle this live configuration update process, the difficulty of which depends on the framework in use.

  • Have another application be responsible for delivering these updates- watch for changes to the ConfigMap, get the list of Pods in the deployment, deliver either a signal or the updated configuration to each of the Pods.

  • Have the first application not get to what k8s recognizes as Ready state without having received updated configuration from the second.

-- Jonah Benton
Source: StackOverflow