Helm 설치
Bash
# Linux
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
# macOS
brew install helm
# 버전 확인
helm version기본 개념
| 용어 | 설명 |
|---|---|
| Chart | Helm 패키지 (k8s 리소스 템플릿 모음) |
| Repository | Chart 저장소 |
| Release | 클러스터에 배포된 Chart 인스턴스 |
| Values | Chart 설정값 (values.yaml) |
레포지토리 관리
Bash
# 공식 stable 레포 추가
helm repo add stable https://charts.helm.sh/stable
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
# 레포 목록
helm repo list
# 레포 업데이트
helm repo update
# 차트 검색
helm search repo nginx
helm search repo bitnami/postgresql차트 배포 (install / upgrade)
Bash
# 기본 설치
helm install my-nginx ingress-nginx/ingress-nginx
# 네임스페이스 지정
helm install my-nginx ingress-nginx/ingress-nginx --namespace ingress-nginx --create-namespace
# values.yaml 파일로 커스터마이징
helm install my-app bitnami/wordpress -f custom-values.yaml
# 커맨드라인으로 값 오버라이드
helm install my-pg bitnami/postgresql --set auth.postgresPassword=MySecretPass --set primary.persistence.size=20Gi
# 드라이런 (실제 배포 없이 확인)
helm install my-app bitnami/nginx --dry-run --debug
# 업그레이드 (없으면 설치)
helm upgrade --install my-nginx ingress-nginx/ingress-nginx릴리즈 관리
Bash
# 배포된 릴리즈 목록
helm list
helm list -A # 모든 네임스페이스
# 릴리즈 상태
helm status my-nginx
# 적용된 values 확인
helm get values my-nginx
# 릴리즈 히스토리
helm history my-nginx
# 롤백
helm rollback my-nginx 1 # 1번 리비전으로
# 삭제
helm uninstall my-nginx직접 Chart 생성
Bash
helm create mychart
# 생성된 구조
mychart/
├── Chart.yaml # 차트 메타데이터
├── values.yaml # 기본 설정값
├── templates/ # k8s 리소스 템플릿
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── ingress.yaml
│ └── _helpers.tpl # 공통 템플릿 함수
└── charts/ # 의존 차트values.yaml 커스터마이징
YAML
# values.yaml
replicaCount: 3
image:
repository: nginx
tag: "1.25"
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 80
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 100m
memory: 64Mi
ingress:
enabled: true
host: myapp.example.com템플릿 문법 기초
YAML
# templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mychart.fullname" . }}
labels:
{{- include "mychart.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
template:
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
ports:
- containerPort: {{ .Values.service.port }}
{{- if .Values.resources }}
resources:
{{- toYaml .Values.resources | nindent 10 }}
{{- end }}Bash
# 템플릿 렌더링 확인
helm template mychart ./mychart -f my-values.yaml
# 린트
helm lint ./mychart편집 안내 · Editorial Note
이 가이드는 AI 도구를 활용해 초안을 구성하고 사람이 명령어·문맥을 검토해 발행했습니다. 운영체제와 도구 버전에 따라 결과가 달라질 수 있으므로 적용 전 공식 문서를 함께 확인하세요. 오류를 발견하시면 이메일로 제보해 주세요.
질문 & 답변 (Q&A)
이 가이드에 대해 궁금한 점을 질문해보세요. 확인 후 답변드립니다.