2

We would like to enrich our kubernetes environment with consul to have a portable layer for application/stage/peer configuration. These would be my steps, based on my current understanding:

  • build / reuse a docker image to provide consul servers
  • write a controller and a service configuration file for kubernetes
  • configure a replication of three, based on details: 1
  • Magic

The magic refers to the fact, that I would need to run a command like:

consul join <Node A Address> <Node B Address> <Node C Address>

on of the replicas that just started. I have two and half obstacles in my head:

  • how will the command only be executed on one machine?
  • how can I access the IP addresses of the peers?
  • as a bonus question: How can I invoke another command, each time a new replica is started / moved?

My gut is telling me to write an own script which communicates with the internal etcd of kubernetes to see which nodes have been registered and picks up from there. Is this the right direction? Will the command in the controller template be fired at the right time, i.e. after the etcd has been updated with the new pod/replica?

Bootstrapping Consul Datacenters

2

Your question is related to an open Github issue https://github.com/kubernetes/kubernetes/issues/5017

Please follow along there for an answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.