DEV Community

Cover image for Kubernetes Operators πŸ¦„ simply explained
TechWorld with Nana
TechWorld with Nana

Posted on • Updated on

Kubernetes Operators πŸ¦„ simply explained

Learn what a Kubernetes Operator is, why this operator concept even emerged and when you should use them


OVERVIEW:
To give you an overview, operators are used mainly for stateful applications. So I first compare how Kubernetes manages stateless and stateful applications. And then compare deploying and managing stateful applications without an operator compared to deploying it with a Kubernetes Operator.

  • 1. StateLESS applications on Kubernetes πŸš€
  • 2. StateFUL applications WITHOUT Operator 🀯
  • 3. StateFUL applications WITH Operator πŸ¦„

β–Ί Watch the complete video 🎬 here: Kubernetes Operators explained

1. Stateless applications on Kubernetes πŸš€

Kubernetes can manage the complete lifecycle of stateless applications in a fully automated way, because these applications don’t have business logic for deployment.

This means K8s doesn’t need to know any application-specific business logic to automatically create, update and delete them. πŸ”

So basically, once you deployed the application, you don’t have to sit there and control that your application is running properly. And when you carry out small changes, like update or scale up, it works pretty much without problems.

That's great! 😎

2. Stateful applications without Operator 🀯

For stateful applications, like databases, the whole process isn’t as straightforward.
They need more "hand-holding" during its whole lifecycle, because the replicas of stateful apps aren't identical.

Stateful applications without operator

Each has its state and identity. This means, they need to be started, updated and destroyed in a certain order. These details will even vary for each application: Mysql will have its own specific way of doing this, Postgres and Elasticsearch have another way of doing it etc. πŸ™„

So, Kubernetes natively/internally doesn’t have all the knowledge required πŸ€·πŸ»β€β™‚οΈ to automate the process of deploying every single stateful application.

That’s why these kind of applications require manual intervention - people who "operate" these applications. πŸ‘©πŸ»β€πŸ’»

3. Stateful applications with Operator πŸ¦„

Operator solves this problem and basically replaces this "human" operator with a "software" operator.

All the manual tasks that devOps teams would do is now packed into a program that has the knowledge and intelligence about how to deploy that specific application, like Postgres or Prometheus. πŸ’‘

So how does Operator do this? πŸ€”

At its core it has the same control loop mechanism that k8s has, that watches for changes in the application state.

Kubernetes Control Loop

It also uses CRDs, which is basically a custom K8s component which extends the Kubernetes API.

So, it takes the basic Kubernetes resources and its controller concept as a foundation to build upon, and on top of that includes domain or application-specific knowledge to automate the entire life cycle of the application it "operates":
Stateful Applications with operator

More details in the video here πŸ‘©πŸ»β€πŸ’»


Kubernetes 101 β–Ί Compact and easy-to-read ebook bundle πŸš€
It's a handy way to quickly look something up or refresh your knowledge at work and use it as your cheatsheet 😎

Like, share and follow me 😍 for more content:

Top comments (0)