'automatically reload Kubernetes pod on consul key change

I have a consul server running on https://dev.example.com/ on which I store configurations as below:

consul key name = dev

consul key value = some yaml data

kubernetes configMap value some yaml data --> ( this is in sync with consul data )

what I want to do is as soon as I change something in some yaml data, the values should be automatically reflected in configMap and pod should be reloaded automatically to capture new values.

I have tried envconsul but it only picks keys with one value.

I tried consul-template but did not find any good working example.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source