Helm
Helm은 Kubernetes에서 폭넓게 쓰이는 패키지 관리 도구예요. Helm 차트는 Kubernetes YAML 매니페스트 문서를 위한 템플릿 문법을 제공하죠. Helm을 쓰면 개발자나 클러스터 관리자는 정적인 매니페스트만 쓰는 대신, 차트(Chart)라고 부르는 '설정 가능한 템플릿'을 만들 수 있어요. 직접 만든 차트 카탈로그를 구성하는 방법이 궁금하다면 https://helm.sh/docs/intro/quickstart/ 문서를 확인해 보세요.
출처: 문서
본문
Helm은 Kubernetes에서 폭넓게 쓰이는 패키지 관리 도구예요. Helm 차트는 Kubernetes YAML 매니페스트 문서를 위한 템플릿 문법을 제공하죠. Helm을 쓰면 개발자나 클러스터 관리자는 정적인 매니페스트만 쓰는 대신, 차트(Chart)라고 부르는 '설정 가능한 템플릿'을 만들 수 있어요. 직접 만든 차트 카탈로그를 구성하는 방법이 궁금하다면 https://helm.sh/docs/intro/quickstart/ 문서를 확인해 보세요.
K3s는 Helm을 지원하기 위한 별도 설정이 필요하지 않아요. 클러스터 접근 문서에 설명된 대로 kubeconfig 경로만 잘 잡아 두면 됩니다.
K3s에는 Helm 컨트롤러가 포함돼 있어요. 이 컨트롤러는 HelmChart 사용자 정의 리소스(CRD)를 통해 Helm 차트의 설치, 업그레이드/재구성, 제거를 관리하죠. AddOn 매니페스트 자동 배포와 짝을 이루면, 디스크에 파일 하나만 만들어도 클러스터에 Helm 차트를 설치하는 일을 자동화할 수 있어요.
Helm 컨트롤러 사용하기
HelmChart 사용자 정의 리소스는 보통 helm 커맨드라인 도구에 넘기는 대부분의 옵션을 담을 수 있어요.
K3s는 helm-controller-arg 로 helm-controller 프로세스에 인자를 직접 전달하는 것도 지원해요. 컨트롤러 동작을 전역적으로 조정하고 싶을 때 유용하죠.
예를 들어 Helm 잡(job) 파드에 할당되는 CPU와 메모리 리소스를 조정하려면 이렇게 해요:
# /etc/rancher/k3s/config.yamlhelm-controller-arg: - 'job-resources={"requests": {"cpu": "0.2", "memory": "64M"}, "limits": {"cpu": "1", "memory": "256M"}}'
helm-controller-arg 는 CLI 형태로 여러 번 지정할 수도 있고, 설정 파일에서는 YAML 목록으로 지정할 수 있어요.
버전 게이트 (Version Gate)
helm-controller-arg 플래그는 K3s 2026년 7월 릴리스부터 사용할 수 있어요: v1.36.3+k3s1, v1.35.7+k3s1, v1.34.10+k3s1, v1.33.13+k3s2
HelmChart 필드 정의
참고 (note)
name 필드는 Kubernetes 객체 이름과 ID에 대한 규칙 외에도 Helm 차트 명명 규칙을 따라야 해요. 자세한 내용은 Helm Best Practices 문서를 참고하세요.
| | Field | Default | Description | Helm Argument / Flag Equivalent
| metadata.name | | Helm Chart name | NAME
| spec.chart | | Helm Chart name in repository, or complete HTTPS URL to chart archive (.tgz) | CHART
| spec.chartContent | | Base64-encoded chart archive .tgz - overrides spec.chart | CHART
| spec.targetNamespace | default | Helm Chart target namespace | --namespace
| spec.createNamespace | false | Create target namespace if not present | --create-namespace
| spec.version | | Helm Chart version (when installing from repository) | --version
| spec.repo | | Helm Chart repository URL | --repo
| spec.repoCA | | Verify certificates of HTTPS-enabled servers using this CA bundle. Should be a string containing one or more PEM-encoded CA Certificates. | --ca-file
| spec.repoCAConfigMap | | Reference to a ConfigMap containing CA Certificates to be be trusted by Helm. Can be used along with or instead of repoCA | --ca-file
| spec.plainHTTP | false | Use insecure HTTP connections for the chart download. | --plain-http
| spec.insecureSkipTLSVerify | false | Skip TLS certificate checks for the chart download. | --insecure-skip-tls-verify
| spec.helmVersion | v3 | Helm version to use. Only v3 is currently supported. |
| spec.bootstrap | false | Set to True if this chart is needed to bootstrap the cluster (Cloud Controller Manager, etc) |
| spec.jobImage | | Specify the image to use when installing the helm chart. E.g. rancher/klipper-helm:v0.3.0 . |
| spec.podSecurityContext | | Custom v1.PodSecurityContext for the Helm job pod |
| spec.securityContext | | Custom v1.SecurityContext for the Helm job pod's containers |
| spec.backOffLimit | 1000 | Specify the number of retries before considering a job failed. |
| spec.timeout | 300s | Timeout for Helm operations, as a duration string (300s, 10m, 1h, etc) | --timeout
| spec.failurePolicy | reinstall | Set to abort which case the Helm operation is aborted, pending manual intervention by the operator. |
| spec.authSecret | | Reference to Secret of type kubernetes.io/basic-auth holding Basic auth credentials for the Chart repo. |
| spec.authPassCredentials | false | Pass Basic auth credentials to all domains. | --pass-credentials
| spec.dockerRegistrySecret | | Reference to Secret of type kubernetes.io/dockerconfigjson holding Docker auth credentials for the OCI-based registry acting as the Chart repo. |
| spec.set | | Override simple Chart values. These take precedence over options set via valuesContent. | --set / --set-string
| spec.valuesContent | | Override complex Chart values via inline YAML content | --values
| spec.valuesSecrets | | Override complex Chart values via references to external Secrets | --values
/var/lib/rancher/k3s/server/static/ 에 둔 콘텐츠는 클러스터 내부에서 Kubernetes APIServer를 통해 익명으로 접근할 수 있어요. 이 URL은 spec.chart 필드의 특수 변수 %{KUBERNETES_API}% 로 템플릿화할 수 있죠. 예를 들어 패키징된 Traefik 컴포넌트는 https://%{KUBERNETES_API}%/static/charts/traefik-VERSION.tgz 에서 자체 차트를 불러와요.
차트 값은 우선순위가 낮은 것부터 높은 순서로 이렇게 적용돼요:
-
차트 기본값 (Chart default values)
-
HelmChart
spec.valuesContent -
HelmChart
spec.valuesSecrets(시크릿 이름과 키가 나열된 순서대로) -
HelmChartConfig
spec.valuesContent -
HelmChartConfig
spec.valuesSecrets(시크릿 이름과 키가 나열된 순서대로) -
HelmChart
spec.set
여기 Bitnami 차트 저장소에서 Apache를 배포하면서 기본 차트 값 일부를 덮어 쓰는 예시가 있어요. HelmChart 리소스 자체는 kube-system 네임스페이스에 있지만, 차트의 리소스들은 같은 매니페스트에서 함께 생성되는 web 네임스페이스로 배포된다는 점을 눈여겨보세요. 이렇게 하면 HelmChart 리소스를 그것이 배포하는 리소스들과 분리해 두고 싶을 때 유용해요.
apiVersion: v1kind: Namespacemetadata: name: web---apiVersion: helm.cattle.io/v1kind: HelmChartmetadata: name: apache namespace: kube-systemspec: repo: https://charts.bitnami.com/bitnami chart: apache targetNamespace: web valuesContent: |- service: type: ClusterIP ingress: enabled: true hostname: www.example.com metrics: enabled: true
인증이 필요한 프라이빗 저장소에서 헬름 차트를 배포하는 예시예요:
apiVersion: helm.cattle.io/v1kind: HelmChartmetadata: namespace: kube-system name: example-appspec: targetNamespace: example-namespace createNamespace: true version: v1.2.3 chart: example-app repo: https://secure-repo.example.com authSecret: name: example-repo-auth repoCAConfigMap: name: example-repo-ca valuesContent: |- image: tag: v1.2.2---apiVersion: v1kind: Secretmetadata: namespace: kube-system name: example-repo-authtype: kubernetes.io/basic-authstringData: username: user password: pass---apiVersion: v1kind: ConfigMapmetadata: namespace: kube-system name: example-repo-cadata: ca.crt: |- -----BEGIN CERTIFICATE----- <YOUR CERTIFICATE> -----END CERTIFICATE-----
시크릿에서 차트 값 가져오기
차트 값은 spec.set 이나 spec.valuesContent 필드에 값을 저장하는 대신, 외부에서 관리되는 시크릿(Secret)에서 읽어올 수 있어요. 인증 정보처럼 기밀한 내용을 existingSecret 패턴으로 기존 시크릿을 참조하지 못하는 차트에 전달할 때 이렇게 하면 돼요.
다른 시크릿(spec.authSecret, spec.dockerRegistrySecret)과 마찬가지로, spec.valuesSecrets 에서 참조하는 시크릿은 HelmChart와 같은 네임스페이스에 있어야 해요.
각 valuesSecrets 항목은 다음 필드를 가져요:
| | Field | Description
| name | The name of the Secret. Required.
| keys | List of keys to read values from, values are used in the listed order. Required.
| ignoreUpdates | Mark this Secret as optional, and do not update the chart if the Secret changes. Optional, defaults to false.
-
ignoreUpdates를false로 두거나 지정하지 않으면, 시크릿과 나열된 모든 키가 반드시 존재해야 해요. 참조된 값 시크릿이 변경되면 차트가 새 값으로 업데이트돼요. -
ignoreUpdates를true로 두면, 차트가 생성되거나 관련 리소스의 다른 변경 때문에 업데이트될 때 시크릿이 존재한다면 그 값을 사용해요. 시크릿이 바뀌어도 차트를 업데이트하진 않아요.
키가 두 개인 기존 시크릿을 이용해 헬름 차트를 배포하는 예시예요:
apiVersion: helm.cattle.io/v1kind: HelmChartmetadata: namespace: kube-system name: example-appspec: targetNamespace: example-namespace createNamespace: true version: v1.2.3 chart: example-app repo: https://repo.example.com valuesContent: |- image: tag: v1.2.2 valuesSecrets: - name: example-app-custom-values ignoreUpdates: false keys: - someValues - moreValues---apiVersion: v1kind: Secretmetadata: namespace: kube-system name: example-app-custom-valuesstringData: moreValues: |- database: address: db.example.com username: user password: pass someValues: |- adminUser: create: true username: admin password: secret
HelmChartConfig로 패키징된 컴포넌트 커스터마이징
Traefik처럼 HelmChart로 배포되는 패키징된 컴포넌트의 값을 덮어 쓰기 위해, K3s는 HelmChartConfig 리소스를 통한 배포 커스터마이징을 지원해요. HelmChartConfig 리소스는 해당 HelmChart의 이름과 네임스페이스가 일치해야 하며, helm 명령에 추가 값 파일로 전달되는 valuesContent 를 추가로 제공할 수 있죠.
HelmChartConfig 필드 정의
| | Field | Description
| metadata.name | Helm Chart name - must match the HelmChart resource name.
| spec.valuesContent | Override complex default Chart values via YAML file content.
| spec.valuesSecrets | Override complect default Chart values via external Secrets.
| spec.failurePolicy | Set to abort which case the Helm operation is aborted, pending manual intervention by the operator.
참고 (note)
HelmChart spec.set 값은 위에서 설명한 대로 HelmChart와 HelmChartConfig의 spec.valuesContent, spec.valuesSecrets 설정을 덮어 써요.
예를 들어 패키징된 Traefik 인그레스 설정을 바꾸고 싶다면, /var/lib/rancher/k3s/server/manifests/traefik-config.yaml 파일을 만들고 다음 내용을 채워 넣으면 돼요:
apiVersion: helm.cattle.io/v1kind: HelmChartConfigmetadata: name: traefik namespace: kube-systemspec: valuesContent: |- image: repository: docker.io/library/traefik tag: 3.3.5 ports: web: forwardedHeaders: trustedIPs: - 10.0.0.0/8