Kubernetes Controller vs Kubernetes Operator?

0
520

Question:

As I understand the purpose of the Kubernetes Controller is to make sure that current state is equal to the desired state. Nevertheless, Kubernetes Operator does the same job.

The list of controller in the Control-plane:

  • Deployment
  • ReplicaSet
  • StatefulSet
  • DaemonSet
  • etc

From the Google Search, I found out that there are K8s Operators such as

  • etcd Operator
  • Prometheus Operator
  • kong Operators

However, I was not able to understand why it cannot be done using Controller?

Is Operator complementing the Controllers?

What’s the difference between these two design as a purpose and functionality.

What certain things need to keep in mind to choose between Controller and Operator? ?

Answer:

I believe the term “kubernetes operator” was introduced by the CoreOS people here

An Operator is an application-specific controller that extends the Kubernetes API to create, configure and manage instances of complex stateful applications on behalf of a Kubernetes user. It builds upon the basic Kubernetes resource and controller concepts, but also includes domain or application-specific knowledge to automate common tasks better managed by computers.

So basically, a kubernetes operator is the name of a pattern that consists of a kubernetes controller that adds new objects to the Kubernetes API, in order to configure and manage an application, such as Prometheus or etcd.

In one sentence: An operator is a domain specific controller.

Update

There is a new discussion on Github about this very same topic, linking to the same blog post. Relevant bits of the discussion are:

All Operators use the controller pattern, but not all controllers are Operators. It’s only an Operator if it’s got: controller pattern + API extension + single-app focus.

Operator is a customized controller implement with CRD. It follow the same pattern with build-in controllers (i.e. watch, diff, action).

LEAVE A REPLY

Please enter your comment!
Please enter your name here