1 min de lectura

Complete Guide to Helm Charts for Kubernetes

Complete Guide to Helm Charts for Kubernetes

Helm is the package manager for Kubernetes. Learn how to leverage Helm Charts to simplify deployments.

What is Helm?

Helm helps you manage Kubernetes applications through Charts - packages of pre-configured Kubernetes resources.

Creating Your First Chart

helm create my-app

This creates the following structure:

my-app/
β”œβ”€β”€ Chart.yaml          # Chart metadata
β”œβ”€β”€ values.yaml         # Default configuration
β”œβ”€β”€ templates/          # Kubernetes manifests
β”‚   β”œβ”€β”€ deployment.yaml
β”‚   β”œβ”€β”€ service.yaml
β”‚   └── ingress.yaml
└── charts/             # Dependencies

Values and Templates

values.yaml

replicaCount: 3

image:
  repository: nginx
  tag: "1.21"
  pullPolicy: IfNotPresent

service:
  type: ClusterIP
  port: 80

resources:
  limits:
    cpu: 100m
    memory: 128Mi

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "my-app.fullname" . }}
spec:
  replicas: {{ .Values.replicaCount }}
  template:
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          resources:
            {{- toYaml .Values.resources | nindent 12 }}

Best Practices

  1. Use semantic versioning for Chart versions
  2. Document values.yaml with comments
  3. Test charts with helm lint and helm template
  4. Use hooks for migrations and cleanup

Conclusion

Helm Charts are essential for managing Kubernetes applications at scale. Master them to improve your deployment workflows.

Liked it? Share it!

Comments (0)

Loading...