<p>Although in an ideal world of Kubernetes you don't need to care about dependencies, the reality is different; we do have applications (consumer services) that rely on backing services (e.g. databases) to be available at startup.</p>
<p>To achieve this deployment order for services we have a few options available with k8s:</p>
<ul>
<li>check the backing service readiness in an init container</li>
<li>check the backing service readiness in the readiness probe</li>
<li>check the backing service readiness in the application itself</li>
</ul>
<p>Now, the backing services do own some configuration properties that are required by the consumer services as well e.g. the k8s service name, credentials, ports etc.</p>
<p>The usual approach I encountered is that these configuration properties are hardcoded into the initContainer/readinessProbe implementation for the consumer service. I think this is suboptimal as you have to manually keep the backing service and consumer service configuration in sync, duplicate the configuration in both services and manually reconfigure the consumer service when the backing service updates its config.</p>
<p>What are some best practices/patterns to keep the consumer service in sync with a backing service configuration changes?</p>
<p>Is it a good practice to rely on operators for backing service deployment and inject secrets/configmaps as requested by the consumer service through CRs?</p>
<p>Thanks!</p>

Laurentiu Soica
<p>You are right,</p>
<p>i think the reality is that without automation, it is impossible to manage the large scalable system of Consumers and Producers.</p>
<p>Operators are widely used for handling database backups &amp; and other automation tasks.</p>
<p>If you see with some scenarios like vault : <a href="https://www.hashicorp.com/blog/dynamic-database-credentials-with-vault-and-kubernetes" rel="nofollow noreferrer">https://www.hashicorp.com/blog/dynamic-database-credentials-with-vault-and-kubernetes</a></p>
<p>They are also using the Operator to solve problems.</p>
<blockquote>
<p>HashiCorp Vault solves this problem by enabling operators to provide
dynamically generated credentials for applications. Vault manages the
lifecycle of credentials, rotating and revoking as required.</p>
</blockquote>
<blockquote>
<p>What are some best practices/patterns to keep the consumer service in
sync with a backing service configuration changes?</p>
</blockquote>
<p>You can use the <strong>vault</strong> to store the <strong>key-value</strong> pair at the central level or secret &amp; configmap to store store creds or files inside it and inject it further.</p>
