Hey everyone , I am very new to using Kubernetes.
I was trying to learn the concepts of controllers, and just wanted to explain what I understand and hopefully someone can correct me?
I followed some tutorials where I was able to create a python controller. From what I can tell, I can use the watch.Watch().stream()
to watch for any events to just about anything like pod states, custom resource changes, etc… Then I can write python code to “do anything I want” based on events that come from watch.Watch().stream()
. I could write python code to do some database backups anytime certain types of pods fail…I can write python code to send some information to my SIEM platform anytime there are changes to custom resource objects I’ve initialized, etc… Is that basically the whole goal of controllers?
When my controllers deal mostly with custom resources, and they are specific to an application/software i’m working on, then it’s called an Operator . For example, if a controller simply emails me details when a pod has failed, that’s not yet an operator. But if I wrote a software called PizzaBrainDatabase, and I use a custom resource to manage backup schedules of PizzaBrainDatabase, and anytime the custom resource changes, I have python code in my controller revoke a lot of old API tokens within the PizzaBrainDatabase cluster, that’s when my approach is considered an Operator, because the approach uses custom resources, a controller and is specific to a single software (ie. PizzaBrainDatabase).
Can someone tell me if I understood things correctly?