⬆️ ⬇️

Kapitan at the helm Kubernetes



Meet Kapitan . It will help you to restore beauty and order in the Kubernetes configuration.



Kapitan earns a reputation on the feedback of satisfied users, and therefore does without extensive documentation and expensive marketing. We have enough stars and a couple of mentions from bloggers and preachers Kubernetes. Kapitan even became the protagonist of an entire chapter in the book . Most importantly, he drew the attention of several promising companies, because Kapitan, like no one else, is able to unravel the configuration tied by a sea knot .



At kubernetes.slack.com, #kapitan managed to gather a small but dedicated community (join us!), So we are proud of our work :)



Many still believe that Kapitan is a mixture of jsonnet and jinja, but they are missing the point.

In this post I will tell you how Kapitan manages Kubernetes deployments, but in general he is not only capable of this. This is important: Kapitan is universal and not fixated on Kubernetes. Kubernetes is simply one of many uses.



This is not a guide (although I promise guides too). I just want to tell you why we made it and what problems it should deal with with the deployment of Kubernetes configurations.



What i didn't like



I started experimenting with Kubernetes in 2015 and immediately fell in love.

True, there are several shortcomings with which I do not want to put up:





What to do?



I tried to solve these problems and put together a small template system that used j2cli and a couple of bash scripts to manage Kubernetes configurations.



The system thrust everything into the environmentA.yaml file and used it in the Jinja2 template. Deploit applications in the style of microservices from several components could be a simple command:



bin/apply.sh environments/environmentA.yaml 


Cool! Yaml was all about deploying. Very convenient, because I could use the same file as a source of information for something else. Say for ... bash scripts !



I figured out how to import values ​​from yaml into scripts in order to execute such commands:



 bin/create_kafka_topics.sh environments/environmentA.yaml 


And then everything went out of control at once :





Kapitan: becoming



We gathered all our bitter experience and, together with Ricardo Amaro, began to fantasize about the ideal configuration management system. Then we did not have a clear picture, but we knew that we love and that we do not.



We love :





Do not like





And then two things happened :



  1. We discovered Dave Cunningham's jsonnet ( Dave Cunningham ) for yaml / json templating in an object-oriented language.
  2. Gustavo Buriola showed us the reclass , and without him we would not have gone far.


Ricardo Amaro took to work, and soon the whole team sat down at Kapitan - some worked on the basic functionality, others worked on its use in our internal projects. Manage secrets, support gpg \ kms, custom functions: now Kapitan is a complete product that does more than promised.



Who is Kapitan?



Kapitan is trying to solve all (well, or almost all) problems that I mentioned.



From a technical point of view, Kapitan is very simple:





We use jsonnet for template manifests and Jinja for everything else.



Sometimes people complain that the jsonnet file is not at all like the same yaml, so it’s difficult for them to switch to jsonnet.



We tried to solve this problem with Kadet by wrapping yaml in Python. Take as a basis your favorite yaml and add Python to it.



Consider it as a Python exoskeleton for yaml! Somehow talk about it.

In the Kapitan workflow , the character immediately shows:





Do I need it?



Let's be clear : you probably Kapitan (still) is not needed.



But it all depends on what you are trying to do and how complicated your system is.



Kapitan is a powerful tool that requires investment. Use it in complex scenarios where you have to deploy a bunch of applications in a bunch of clusters.



If you have standard applications, you are just learning Kubernetes or are already satisfied with your workflow, then Helm or its current alternative will do.



I imagine Helm as apt-get for Kubernetes , and Kapitan is something like Puppet .



In the next post I will give specific examples and describe the inventory in detail. Write about what you want to know or with which you agree / disagree in this post.



Thanks to Jacek Gruzewski .



')

Source: https://habr.com/ru/post/442844/



All Articles