K8s Helm Tutorial: Better Way to Define K8s Objects

Jul 8, 2022
4 min
read
Yulia Melnychenko
Software Engineer
monokle

Learn how to preview, navigate, edit, and validate Helm Outputs with Monokle. Gain visibility and control of the exact resources being deployed to your Kubernetes cluster via Helm charts.

Share on Twitter
Share on LinkedIn
Share on Reddit
Share on HackerNews
Copy URL

Table of Contents

Get started with Monokle today

As the use of Kubernetes expands, we’ve learned that creating objects through yaml configuration isn’t very convenient. Creating objects and other yaml related configuration tasks get messy when the amount of files grows, meaning that copying them back and forth isn’t a fun or efficient way of working. 

## What is Helm?

[According to the CNCF](https://www.cncf.io/blog/2020/08/26/why-do-devops-engineers-love-helm/), Helm package manager helps teams manage Kubernetes applications through a series of charts. These charts help teams define, install, and upgrade even the most complex Kubernetes applications. 

Helm often comes to the rescue of Developers and DevOps by helping to conquer the task of creating yaml objects in a more productive way. However, once you start using Helm, one of the intrusive downsides is that you no longer have visibility of the exact resources being created and deployed to your cluster. Basically, all control of configuration files is delegated to whoever wrote the original Helm chart. This isn’t necessarily a bad thing, but sometimes users may run into an obscure error, find an erroneous solution on the internet, or deploy a more stable new chart - ending up with two different charts adding additional problems to an already complex task.

It’s essential to understand the main requirements and prospects of a particular project to decide whether to resort to a ready-made solution or not. Making this decision helps to better manage and validate Kubernetes yaml files while stopping the snowball effect of installing Helm charts to maintain code configurations. Once a decision is made, it’s high time to find the right tool to help complete the task at hand.

Monokle is an open source desktop UI app for managing Kubernetes configuration tasks including Kubernetes yaml manifests. Monokle has built-in support for Helm users helping to tackle the creation and validation of Helm charts as well as editing and debugging existing yaml files, syntax errors, and other Kubernetes manifest related issues. [guide](https://kubeshop.github.io/monokle/helm/)

## Preview 

It’s not always obvious what resources will be deployed to a Kubernetes cluster when working with a Helm chart. Monokle’s Helm preview feature gives the unique possibility to inspect the resources that pertain to a specific set of values files and Helm configuration parameters . Once in preview mode, you will be able to see all resources generated by running Helm with the selected values-file(s) and parameters in the Navigator. It also allows you to see the resource content in the source editor through our read-only mode. 

editing values yaml file
Selecting preview for values-files
helm chart previews for clusters
Preview mode

In the Navigator’s subsection labeled *Preview Configuration*, you can choose how to run the Helm Preview and then save the configuration to access it and use it again to manage future Helm charts. Configuration forms allow you to easily name your configuration, select which values-files to be used for the preview, and order them in a specific sequence, choosing an option between using the provided Helm template or using Helm install commands. Each configuration is unique for every particular Helm chart.

## Helm-aware navigation and editing

Helm charts that contain numerous yaml files/templates are common practice. Monokle makes file navigation easy to manage by structuring and grouping them giving you better overall visibility of file resources. When selecting a folder containing Helm charts (identified by Chart.yaml files), they are automatically be displayed in the *Helm Charts* section on top of the Navigator. 

From here, users can see all Kubernetes resources found by Monokle in the selected folder and manage them accordingly. In the source code editor, you can view all resources and make any necessary changes by using the editor itself or by using the Object Metadata Editor - a form editor that collects the required information and passes it to another entity. 

Helm chart storage

One of the Monokle’s killer features for Helm users, is a tool tip that emerges when hovering over a value with information about its location in files and reference links that take you to the exact file and code line containing the property. Since they have distinctive highlighting than your Helm templates, these values are easy to spot in the code editor panel allowing you to navigate between the values and its references quickly and easily.

ai tips for yaml file configuration

## Validating Generated  Resources

Monokle automatically validates all resources generated during a Helm Preview against the configured Kubernetes schema version (1.22.1 by default). Furthermore, references between resources are validated, to help you spot any invalid links that would cause troubles when your resources are deployed to a Kubernetes cluster.

The Navigator UI is tailored to automatically highlight any found errors,  resources which are not valid are shown with a red error icon while resources with a broken link are indicated by a yellow triangle.

git version control of cluster
Details for the resources with broken links
helm validation errors
Validation errors are shown on hover

Monokle also has integrated OPA validation support to ensure your generated resources are in line with established security and configuration policies: select the validation panel on the left and enable/configure which policies you would like to use and Monokle will automatically validate all resources (vanilla or generated) against them and show corresponding errors.

Read more about Monokle OPA functionality in [our documentation](https://kubeshop.github.io/monokle/resource-validation/#inspecting-policy-errors).

Available OPA rules

## Monokle Big Picture

Monokle focuses on creating comfortable workflows to support optimal pre-deployment troubleshooting for Kubernetes users that are using Helm to manage their configurations. With this tool, you can easily navigate, preview, edit, and debug Helm charts for a more productive workflow and faster, successful deployments. 

There are other features Monokle offers for improving the quality of Kubernetes deployments including the ability to update cluster resources in real-time, the Compare and Sync feature which can be used for diffing resources against each other, Open Policy Validation security rules and templates, special [features for Kustomize users](https://kubeshop.io/blog/a-faster-kustomize-workflow-in-kubernetes-with-monokle), and more! 

To explore more applications of Monokle, [a guide of cluster management and Kubernetes Manifests can be found here](https://kubeshop.io/blog/monokle-101-managing-your-kubernetes-manifests).

Download our latest version of Monokle and get started today [website](https://monokle.kubeshop.io/download) and get in touch to contribute insights or praise to our Monokle Team on our [Discord Server](https://discord.gg/uNuhy6GDyn).

Related Content