Convert Kubernetes YAML Files Into Helm Charts
Helmify
In this blog, we will see converting yaml files to helm charts using helmify.
Helm Charts
Helm makes easy to define, install and upgrade even the most complicated Kubernetes applications. Helm helps you manage Kubernetes applications. Chart creation, versioning, sharing and publishing are simple tasks.
YAML
YAML is a digestible data serialization language often used to create configuration files with any programming language. Designed for human interaction, YAML is a strict superset of JSON, another data serialization language. But because it’s a strict superset, it can do everything that JSON can and more.
Helmify
Helmify reads a list of supported k8s objects from stdin and converts it to a helm chart. Designed to generate charts for k8s operators but not limited to Read on:
Let’s see one example on helmify
Install Helmify
brew install helmify
Install helmify on other OS’s by extracting here.
Create Sample YAML deployment file
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
We can also get YAML file for existing services on k8s and can convert that to using helmify.
Convert YAML file to Helm
cat web.yaml | helmify nginx-server
After running helmify, it creates a chart template with updated code as shown in below image
From directory with yamls:
We can create on folder as well,
awk 'FNR==1 && NR!=1 {print "---"}{print}' /<my_directory>/*.yaml | helmify mychart
Will create ‘mychart’ directory with Helm chart from all yaml files in <my_directory>
directory.
Read More here
Conclusion
Helmify allows us to create helm charts with existing Kubernets services or from K8s yaml files
If you found this article helpful, please don’t forget to hit the Follow and Clap buttons to help me write more articles like this.
Thank You 🖤