Hello Hashnode Community, today we will discuss a fantastic Open Source DevOps tool that will allow us to optimize our lives.
If you are just started with Kubernetes and are using it in production, such as studying or preparing for certifications, this tool will be handy.
So, let's see an example first. Let's say you're working with YAML files, and you have a Kubernetes YAML file that looks something like this 👇
And you want to debug or alter something in this file, but imagine you have a massive file with a lot of resources and objects and all these other kinds of stuff. As a result, troubleshooting and managing the Kubernetes manifest is difficult and time-consuming.
- So, we will learn about a tool that will help us solve these problems. As I previously stated, if you're working with K8s or are just getting started with Kubernetes manifests, we have a tool to help you manage those files.
So, how do we make it easy for you to manage your Kubernetes manifest files? Come into the picture, Monokle by Kubeshop.
Monokle makes it easy for you to manage and debug your manifests before you deploy them to your cluster.
So, we will see:
- Features Of Monokle
- Hands-On Demo of Monokle
- How we can work with Kustomize in Monokle
- and, So many Other Things
- Basic knowledge of K8s
- Basic knowledge of Dockers
So, let's get started.
Features Of Monokle
So, firstly we'll see some Features Of Monokle then we will get the hands-on demo of it.
1️⃣ Accelerate your K8s Manifest workflows.
2️⃣ Real-time alerting of syntax, schema, and reference errors. 👇
3️⃣ Maintain cluster resources in real-time.
4️⃣ Modify your resources directly with form and source editors (You don't need to edit your YAML files).
5️⃣ Ensure deployment success the first time, so you can get back to coding (no need to wait for K8s to show you what is wrong).
So, these are some features of Monokle. Now it's time to take a Deep Dive into monokle and get our hands dirty.
Hands-On Demo Of Monokle
-So, here you can see that monokle is a desktop UI for managing Kubernetes manifests that provides a high-level overview of all your manifests.
So, before moving forward, let me show you a short definition of Monokle.
Monokle helps you quickly get a high-level view of your manifests and their contained resources, easily edit resources without having to learn yaml syntax, diff resources against your cluster, preview and debug resources generated with kustomize or Helm, and more.
To begin downloading Monokle, click the Download Button.👇
And, then you can download for Windows, Mac OS, and Linux. You can also check out the Source Code if you want to explore it more.
So, for this click here. You will come to this page👇.
Click on the "Green Button" and Clone the repository (If you want to contribute to Monokle, you can also fork it).
If you are not familiar with Git and GitHub, then you can check out this tutorial.
After cloning the repository, launch Monokle to see this type of interface.👇
Here 👆 you can see three options. You can choose any one of them.
As we have already cloned the repository, we will choose the first option. You can select the second option if you want to build from scratch or the third option if you wish to choose from the default templates.
So, after clicking on the first option, select the folder. Navigate to the folder where you cloned the repository, then there select 👇
and within it selects 👇
Now, after selecting the location and folder, we'll see that now monokle open up our folder that looks like this.👇
We now have too many alternatives, which we shall explore individually.
So, the first feature we can say is Filter Option. Here we can filter out our pods, services, ingress, job, etc. We can also create new resources and set the namespaces. (You can see that here)👇
You can see that here 👆 I have filtered out with “Service Account”.
2. Kustomize Navigation (Working with Kustomize File)
Here we have the Kustomize Option, where we can navigate and explore more things.
The Kustomizations section shows all kustomization.yaml files.
— The corresponding kustomization.yaml file has been highlighted to the left.
— All “downstream” kustomizations and included resources are highlighted in the Navigator, helping you understand the “scope” of the selected kustomization.
— The content of the kustomzation resource is shown in the Source editor to the right, with corresponding resource links marked in the code.
Just as with K8s resources, hovering over the link-icon to the right of the kustomization name shows its outgoing links:👇
Hovering the link-icon to the left of the kustomization name shows its incoming links.👇
3. Kustomize Preview
So here we have Preview Functionality. The Preview functionality helps you understand what resources would be installed in your cluster when running kustomize.
Hovering over a kustomization reveals Preview action to the right:
(Preview Action) look like this 👇(only if you have installed "kubectl")
otherwise, it will show this error👇
For example, previewing the "base" kustomization above will result in the following:
Monokle is now in Preview Mode (as indicated by the header at the top):
The File Explorer has been disabled.
The Navigator now contains all resources generated by running Kustomize with the "base" kustomization:
⚫ Resource navigation works as with files; selecting a resource shows its content in the source editor in read-only mode.
⚫ Resource links are shown as before with corresponding popups/links/etc.
Selecting Preview for a different kustomization will switch the output of kustomize to that resource instead.
Selecting Exit in the top right or next to the kustomization restores the previous resource navigator.
Here, we can see that the selected kustomization resulted in 7 resources that contain references to the image specified in the kustomization configuration:👇
4. No Need To Edit YAML
We no longer need to alter large YAML files thanks to Monokle's this feature. Monokle makes it easy for us.
Here, I have a YAML file, which is tiny (you can take any big or small YAML file).👇
Now, if I want to edit this 👆 file, it will be easy. But if we have a large YAML with a lot of content, it would be hard for us to manage and change it. So for that, we have an option of Forms. 👇
I have a YAML file with various port settings that I want to alter here. So what I should do in that case is:
Click on Forms
Find port (find which value you want to change)
Here, I will change the port value from 8090 to 8080. 👇
Now you can see that the port value has changed in the YAML file.
-Maybe it's not that much needed for small YAML files, but it's necessary for big YAML files.
5. Editing of Kustomizations During Preview
Last but not least, when previewing a kustomization, it is possible to edit the previewed kustomization.yaml file and recreate the preview, allowing you to quickly assess the impact of any changes on the generated files instead of having to exit and restart the preview to make a change.
So, that's the wrap-up for this blog we learn about:
- Features Of Monokle
- How we can work with Kustomize in Monokle.
For future blogs, we will see:
- How to work in Monokle with Helm Chart
- and how we can work with Cloud Clusters.
I hope you find it beneficial. Please share this blog with your friends if you found it useful or if you learned something from it.