"Operators make use of the controller pattern"
<p>What is controller pattern in k8s operators ?</p>

Norbix
<p>The controller pattern has been summarized in these 3 sentences:</p>
<blockquote>
<p>A controller tracks at least one Kubernetes resource type. These objects have a spec field that represents the desired state. The controller(s) for that resource are responsible for making the current state come closer to that desired state.</p>
</blockquote>
<p>Ref: <a href="https://kubernetes.io/docs/concepts/architecture/controller/#controller-pattern" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/architecture/controller/#controller-pattern</a></p>
<p>Basically, the Kubernetes controllers watches for the respective resource in a control loop. Once, it find a resource, it reads the desired state from the spec and do some work to make the cluster state same as the desired state.</p>
<p>For example, you have created a Deployment where you have specified in the <code>spec</code> that you want 1 pod that runs your application. Now, Deployment controller sees this and create 1 pod in the cluster to match your desired state. Now, if you update the Deployment spec and say that you now want 2 pods. The Deployment controller will see this change as it is always watching for Deployment and create another pod in the cluster to match the desired state.</p>
<p>You can find more details about these in the following resources:</p>
<ul>
<li><a href="https://speakerdeck.com/govargo/inside-of-kubernetes-controller" rel="nofollow noreferrer">Inside of Kubernetes Controller</a></li>
<li><a href="https://engineering.bitnami.com/articles/a-deep-dive-into-kubernetes-controllers.html" rel="nofollow noreferrer">A deep dive into Kubernetes controllers</a></li>
</ul>
