Helm é o gerenciador de pacotes do Kubernetes. Em 2026, o Helm 3 com suporte OCI, ganchos de ciclo de vida aprimorados e o vasto repositório ArtifactHub o tornam a maneira padrão de instalar, atualizar e gerenciar aplicativos Kubernetes. Este guia leva você desde o primeiro gráfico até as implantações do Helm em nível de produção.
📋 Table of Contents
Por que Helm?
- Gerenciamento de pacotes— instale aplicativos complexos (PostgreSQL, Redis, Prometheus) com um comando
- Modelos— reutilizar manifestos do Kubernetes em ambientes com variáveis
- Gerenciamento de liberação— reverter para qualquer versão anterior instantaneamente
- Gerenciamento de dependências— declarar e gerenciar dependências de gráficos
- ArtefatoHub— Mais de 10.000 gráficos comunitários para aplicativos populares
Instalação
# macOS
brew install helm
# Linux
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
# Verify
helm version
# Add popular repositories
helm repo add stable https://charts.helm.sh/stable
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
Instalando gráficos
# Search for charts
helm search repo postgres
helm search hub nginx
# Install PostgreSQL
helm install my-postgres bitnami/postgresql --namespace database --create-namespace --set auth.postgresPassword=secretpassword --set primary.persistence.size=20Gi
# Install with custom values file
helm install my-app ./my-chart -f values.prod.yaml
# Check release status
helm list -n database
helm status my-postgres -n database
# Get notes after install
helm get notes my-postgres -n database
# Upgrade release
helm upgrade my-postgres bitnami/postgresql --namespace database --set auth.postgresPassword=newpassword
# Rollback
helm rollback my-postgres 1 # rollback to revision 1
# Uninstall
helm uninstall my-postgres -n database
Criando seu primeiro gráfico
# Scaffold a new chart
helm create myapp
# Structure:
# myapp/
# Chart.yaml - chart metadata
# values.yaml - default values
# templates/ - Kubernetes manifests (templated)
# deployment.yaml
# service.yaml
# ingress.yaml
# _helpers.tpl - template helpers
# NOTES.txt - post-install notes
# charts/ - dependency charts
# .helmignore
Gráfico.yaml
apiVersion: v2
name: myapp
description: My production application
type: application
version: 0.1.0 # chart version (semver)
appVersion: "1.2.3" # app version
dependencies:
- name: postgresql
version: "13.x.x"
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
- name: redis
version: "17.x.x"
repository: https://charts.bitnami.com/bitnami
condition: redis.enabled
valores.yaml — Configuração
replicaCount: 2
image:
repository: mycompany/myapp
tag: "1.2.3"
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 8000
ingress:
enabled: true
className: nginx
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
hosts:
- host: myapp.example.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: myapp-tls
hosts:
- myapp.example.com
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 100m
memory: 128Mi
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10
targetCPUUtilizationPercentage: 70
postgresql:
enabled: true
auth:
database: myapp_db
existingSecret: myapp-db-secret
redis:
enabled: true
architecture: standalone
Exemplos de modelos
# templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "myapp.fullname" . }}
labels:
{{- include "myapp.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "myapp.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "myapp.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.port }}
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: myapp-db-secret
key: database-url
- name: APP_VERSION
value: {{ .Chart.AppVersion | quote }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
livenessProbe:
httpGet:
path: /health
port: {{ .Values.service.port }}
initialDelaySeconds: 30
periodSeconds: 10
Vários ambientes
# values.dev.yaml — development overrides
# helm install myapp ./myapp -f values.yaml -f values.dev.yaml
# values.prod.yaml — production overrides
# helm install myapp ./myapp -f values.yaml -f values.prod.yaml
# values.prod.yaml
replicaCount: 5
image:
tag: "1.2.3-stable"
resources:
limits:
cpu: 2000m
memory: 2Gi
requests:
cpu: 500m
memory: 512Mi
autoscaling:
enabled: true
minReplicas: 5
maxReplicas: 50
Leme em CI/CD
# .github/workflows/deploy.yml
- name: Deploy with Helm
run: |
helm upgrade --install myapp ./charts/myapp --namespace production --create-namespace --set image.tag=${{ github.sha }} --set image.repository=ghcr.io/${{ github.repository }} -f values.prod.yaml --wait --timeout 10m --atomic # rollback automatically on failure
Comandos úteis do Helm
# Lint chart before install
helm lint ./myapp
# Render templates without installing
helm template myapp ./myapp -f values.prod.yaml
# Diff current vs proposed changes
helm plugin install https://github.com/databus23/helm-diff
helm diff upgrade myapp ./myapp -f values.prod.yaml
# Show all values (defaults + overrides)
helm get values myapp -n production --all
# History
helm history myapp -n production
O Helm em 2026 é essencial para qualquer implantação do Kubernetes além de simples cargas de trabalho de demonstração. Comece instalando gráficos de comunidade para dependências (PostgreSQL, Redis, Prometheus) e, em seguida, crie seus próprios gráficos para implantações de aplicativos. O sistema de modelos torna o gerenciamento de vários ambientes limpo e reproduzível.
🔗 Share this article
✍️ Leave a Comment