Fundamentals for solid kubernetes controllers

In the last post, I explained the utility and purpose of Kubernetes Controllers. This post will explain how to build them, and how to think about designing them. We’ll go into Controller patterns, anti-patterns, and sharp edges of the model that you’re bound to run into. controller-runtime - use it. Or don’t, I don’t care. It’ll probably help though. You can absolutely build a controller from scratch using client-go (and sometimes that makes sense), but most of the time you should just get started with controller-runtime. It provides a batteries-included approach to handling typical Kubernetes controller patterns and gives you everything you need when it comes to things like leader election (you want HA, right?), metrics & events, caching, and even webhook setup and serving. When you just need to watch some resources and have your controller reconcile some state when the resource changes, controller-runtime is awesome. ...

December 13, 2024 · Tony

Kubernetes controllers explained

Controllers aren’t just add-ons to Kubernetes - they’re fundamental to how the whole system works. They’re the caretakers of your cluster, overseeing and orchestrating processes to ensure your defined resources stay on track. Whether it’s maintaining pod replicas, managing rolling updates, or handling node lifecycles, controllers are there making sure things run smoothly. The Kubernetes documentation explains their job as follows: In Kubernetes, controllers are control loops that watch the state of your cluster, then make or request changes where needed. Each controller tries to move the current cluster state closer to the desired state. ...

December 13, 2024 · Tony

Doing kubernetes on the cheap

Most SRE-aligned engineers will tell you they have a home lab. Depending on how grey the beard is, it may be an old blade they acquired when a company moved data centers, an intricate setup of Raspberry Pi 4s set up in a custom cooling rack, or like me and many others, it may just be an old gaming computer they no longer use but cannot bring themselves to get rid of. Whatever it may be, it’s usually used for learning, tinkering, or to run some of the /r/selfhosted favorites. ...

December 31, 2023 · Tony