Foreword

Ok so I know this isn’t new tech (as such) but it is something that seems to be gathering a lot of momentum in the K8s space right now, and looking around when I first started, there wasn’t a lot of “low level” documentation out there.

After a lot of head scratching, reading, more head scratching, YouTube videos, even more head scratching… I finally had my lightbulb eureka moment when it all finally made sense to me. So I thought I’d write this blog article in an attempt to save people the pain I went through.

What is an Operator?

Right lets start at the beginning… I’m guessing you’ve arrived at this page because:

You’re working a project that involves Kubernetes

Someone has mentions one of the many Kubernetes buzzwords (Controller, Operator, CRD, Group or Kind)

Someone has randomly said “Oh wouldn’t it be great if Kubernetes could automate this thing for me?”

You’ve read the material out there about operators & sat there like “WTF?!?!?!”

it’s enough to make you cry

Well worry not, help is at hand!

We can think of an Operator as a bundled unit of logic that performs some complicated business logic within Kubernetes.

Ok… great… but that’s very abstract…

Fact is we have probably all already dealt with Kubernetes Operators, we just didn’t know it:

kubectl get pods

At a very abstract level, the command above uses one the the default K8s Operators, the “Pod” operator and the operand we are performing is the “get” op.

And if we want to create or delete a new pod we have operators for these tasks too. We just need to know how to use them and when. We don’t need to know how Kubernetes creates pods, or where it goes to get the info about pods, that is business logic at the K8s level we don’t care about. But what we do care about is that the once we have a pod and a service running on that pod, Kubernetes will monitor it and re-create it if it has issues and terminates.

But Kubernetes already does all that for me right??

Okay, so we have our definition, but now you’re sat there and thinking to yourself “Kubernetes already does all this under the hood for me anyway right… it automatically scales things and spins up new things when pods die without me doing anything? Why should I care?”

You would be correct, it does indeed do those things, and 9/10 times you can get by without even having to think of using operators. But where things do get interesting is when you have to start thinking about state!