Create Custom Controllers with Metacontroller
Distributed Services with Go — by Travis Jeffery (81 / 84)
👈 Create a Google Kubernetes Engine Cluster | TOC | Deploy to the Internet 👉
We could deploy our service with no changes and our service would function the same as it did in our local Kind cluster. But we want to extend our deployment setup to expose our service on the Internet. Because our service load balances client-side, each pod needs its own static IP, so we need a load balancer service for each pod. It’d be nice for Kubernetes to automatically create the load balancers as the pods scale up and delete them as the pods scale down, but Kubernetes doesn’t support this out of the box.
Enter Metacontroller.
Metacontroller[69] is a Kubernetes add-on that makes it easy to write and deploy custom controllers with simple scripts. Metacontroller lets us hook into Kubernetes’ changes so that we can compose with our own changes. Metacontroller handles all the interactions with Kubernetes’ API, including running a level-triggered reconciliation loop on your behalf. You just receive JSON describing Kubernetes’ observed state and return JSON describing your desired state. You can build features in Kubernetes that would require writing an Operator[70] (a popular pattern for extending Kubernetes), with less code and effort than an Operator requires.