DEV Community

Cover image for Do I need Cluster API?
gianarb
gianarb

Posted on

Do I need Cluster API?

Let's try to answer this question that I get a lot those days: "Do I need Cluster API?"

Cluster API is a Kubernetes sub-project focused on providing declarative APIs and tooling to simplify provisioning, upgrading, and operating multiple Kubernetes clusters. by Cluster API website?

If I have to think about what Kubernetes is good at, or what I like about it, those are the first things that show up in my mind:

  • The Kubernetes API is very flexible; you can create Custom Resource Definition, the metadata are great, versioning is embedded in.
  • The ability to outsource my dreams to an entity that not only realizes (or does it best to get there) them, but keeps them up for is superb.

The last point in practice is this:

# Please, please please, I want a namespace
# for all my cool resources

$ kubectl create namespace cool-project 
> Do not worry, I will take care of it

Cluster API does the same but for the Kubernetes cluster. So the first consideration to do to answer this question effectively is: "How dynamic is my system?". The possible answers are two: low or high.

There aren't numbers to decide if you have a dynamic or static environment. It is a combination of how frequently you release code in production, how many times you re-build your environment. The more it changes more dynamic it is.

Like everything in the DevOps land, Cluster API works for both use cases, but I think there is also a wrong answer. A low dynamic environment is risky because you can't freeze the time, and if you don't move or you move slowly, you won't be able to solve unknowns issues that WILL show up quickly; it is just a matter of time.

So if your answer is low try to think about: "do I feel safe with this way of working?" if the answer is yes, I guess you don't need Cluster API. At least there are better solutions for your problem.

What's the problem Cluster API solves? It makes Kubernetes Cluster provisioning and management more reliable, in the same way, it improves our ability to recover from failures when running applications in a Pods.

To be fair, your applications do not get smarter because they run in a Pod, but because Kubernetes puts you in the position to exercise your applications for failure. This is the best way we have right now to improve reliability.

Cluster API does the same with Kubernetes clusters themself, we treat clusters as pets because we are scared to recover them, but this is not a great position; it is like not deploying on Friday to avoid bad weekends. If you are afraid to deploy on Friday, it will be painful for you to handle unforeseen issues when you are on holiday or not ready to address the unforeseen problems (what?).
So do you run a not that dynamic environment, but you want a framework that helps you to more reliability swap, update, replace Kubernetes clusters? You should have a look at Cluster API..

If you run a dynamic environment because:

  • you are at scale, and you have multiple Kubernetes cluster spread across datacenters
  • You have to spin up Kubernetes clusters on-demand for developers or customer
  • who knows, because you like to be cool and speak at KubeCon

You should have a look at Cluster API because it is designed to bring the experience your provider has when it comes to Kubernetes provisioning to you in a reliable, repeatable, and programmatic fashion.

I often say, and it applies here as well you don't need to change your old car (or Cluster API) if it works well for you, and you feel good about driving it. Just be sure to pay the insurance, clean it up from time to time, and keep up with a regular vehicle inspection.

Now that you have a better clue about why there is a good amount of documentation and articles about how:

If you have other articles about how to use Cluster API that you would like to see listed here or if you want to chat about Cluster API and other whys I am @gianarb on twitter.

Write sustainable code. Enjoy
Gianluca

Top comments (0)