What's the difference between a Kubernetes Controller and an Operator?

kubernetes operator controller difference

2 min read | by Jordi Prats

In Kubernetes some times we talk about controllers and operators as if they are interchangeable. Some times they are, but there's a difference that in some cases makes it incorrect.

A controller refers to the software pattern of having a control loop that watches the state of the system and makes changes to bring the system to the desired state. For example, a ReplicationController ensures that a specified number of replicas of a pod are running at all times. If a pod goes down, the ReplicationController will create a new one to replace it

On the other hand, an operator in Kubernetes is a software extension to Kubernetes that makes use of custom resources and controllers to manage the lifecycle of something: They are meant to include custom logic and decision-making abilities to be able to handle the lifecycle of whatever they are managing: We can say that operators are built on top of controllers, offering additional functionality and flexibility.

In summary, all the Kubernetes Operators contains at least one controller, but not every controller uses custom resources (for example the ReplicationController) so some controllers might not be (part of an) operators.

Posted on 25/01/2023