Helm 이란


Helm 은 쿠버네티스의 패키지 관리자다. 여기서 패키지는 Helm Charts 를 패키징한 것을 의미한다.

Helm Charts

hello-world-chart/
├── charts/     # Dependency Charts
├── templates/  # Templates directory
├── Chart.yaml  # Chart information
└── values.yaml # Configurable values

Helm Chart 는 기본적으로 위와 같은 형태로 구성된다. 쿠버네티스 리소스 YAML 파일을 template 으로 만들고 metadata 파일 등을 압축한 파일이다.

kubectl apply -f app-deploy.yaml
kubectl apply -f app-pv.yaml
kubectl apply -f app-pvc.yaml
kubectl apply -f app-svc.yaml
kubectl apply -f app-secret.yaml

쿠버네티스에 Application 을 배포하려면 Deployment, PV, PVC, Service, Secret 등 다양한 리소스를 생성해야 한다. Helm Chart 는 이런 리소스들을 templates/ 디렉터리에 모아서 한 번에 관리하고 template 으로 만들어 상황에 맞춰 values 를 주입해 커스텀 할 수 있게 한다. 즉, 쿠버네티스 입장에선 Helm 이 쿠버네티스 클러스터에 설치되는 모든 리소스를 관리하는 패키지 매니저 역할을 수행하는 것이다.

Helm Commands


helm install

# helm install <release-name> <chart-name or path/to/Chart.yaml>
helm install my-site bitnami/wordpress
helm install my-2-site bitnami/wordpress

동일한 Chart 로 여러 Application 배포할 때 Release Name 을 지정하여 Application 을 독립적으로 관리할 수 있다. Application 의 Release, Chart 등의 Metadata 는 Secret 형태로 보관된다. Release Object 를 활용하여 template 에 {{ .Release.Name }}, {{ .Release.Namespace }} 등을 추가할 수 있다.

helm install my-release bitnami/wordpress -n test-ns --create-namespace --values custom-values.yaml

Application 의 설정값을 바꾸고 싶은 경우 custom configuration values 들을 선언한 YAML 파일을 넘겨줄 수 있다.

helm list

# helm list -n <namespace>
helm list
NAME          NAMESPACE    REVISION    UPDATED    STATUS    CHART                     APP VERSION
my-release    default      1           2026-...   deployed  bitnami/wordpress-0.0.1

helm get all

# helm get all -n <namespace> <release-name>
helm get all my-release

현재 Release 의 정보를 확인하기 위해 사용한다. 설치된 모든 YAML 파일을 출력한다.

helm upgrade

helm install -n test v1 .
helm upgrade -n test --set image=nginx:1.21.4 v1 .  # REVISION 이 올라간다

Helm upgrade 하면 RolingUpdate 등 정책에 따라 Pod 가 재가동된다.

helm rollback

# helm rollback <release-name> <revision-number>
helm rollback -n test v1 1  # 특정 REVISION 으로 롤백 가능하다
helm history -n test v1     # REVISION 목록을 볼 수 있다

helm uninstall

helm uninstall my-release

References