DEV Community

Cover image for Kubernetes Operators ๐Ÿฆ„ simply explained
TechWorld with Nana
TechWorld with Nana

Posted on • Edited 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)