헬름을 사용하려면 먼저 쿠버네티스 환경이 구성되어 있어야 합니다.


설치

shell 에서 설치

curl 을 사용해서 설치 스크립트를 다운받은후에 설치할 수 있습니다.

$ curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
BASH


다운로드가 끝났으면 헬름 설치 스크립트를 실행합니다.

$ bash ./get_helm.sh

Downloading https://get.helm.sh/helm-v3.7.2-linux-amd64.tar.gz
Verifying checksum... Done.
Preparing to install helm into /usr/local/bin
[sudo] password for lesstif: 
helm installed into /usr/local/bin/helm
BASH


package manger 사용

패키지 관리자를 사용해서 helm 을 설치할 수 있습니다.


OSX 는 brew 를 사용해서 설치합니다.

$  brew install helm
BASH


Windows 사용자는 chocolatey 를 사용하면 됩니다.

$ choco install kubernetes-helm
BASH


ubuntu 사용자는 apt 로 설치할 수 있지만 먼저 헬름 저장소의 공개키를 임포트해야 합니다.

$ curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -
$ sudo apt-get install apt-transport-https --yes
BASH


헬름 저장소를 추가하고 apt 로 설치해 줍니다.

$ echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
$ sudo apt-get update
$ sudo apt-get install helm
BASH


사용

helm 이라고 치면 사용법을 출력합니다

$ helm

The Kubernetes package manager

Common actions for Helm:

- helm search:    search for charts
- helm pull:      download a chart to your local directory to view
- helm install:   upload the chart to Kubernetes
- helm list:      list releases of charts

Environment variables:
BASH


chart 저장소 추가

헬름을 설치했으면 제일 먼저 차트 저장소(helm chart repository) 를 등록하고 초기화합니다. 한국어 예제 문서에는 stable 차트로 설명하지만 여기 있는 차트는 대부분이 DEPRECATED 됐습니다.

영어 문서는 bitnami 를 차트 저장소로 사용하고 있고 차트들이 잘 관리되고 있으므로 아래처럼 비트나미를 등록합니다.

$ helm repo add bitnami https://charts.bitnami.com/bitnami
BASH


차트 저장소가 추가됐으면 설치 가능한 차트 목록을 확인할 수 있습니다.

$ helm search repo bitnami

NAME                                            CHART VERSION   APP VERSION     DESCRIPTION                                       
bitnami/bitnami-common                          0.0.9           0.0.9           DEPRECATED Chart with custom templates used in ...
bitnami/airflow                                 11.1.13         2.2.3           Apache Airflow is a platform to programmaticall...
bitnami/apache                                  8.11.1          2.4.52          Chart for Apache HTTP Server                      
bitnami/argo-cd                                 2.0.20          2.2.2           Declarative, GitOps continuous delivery tool fo...
BASH

차트 설치

chart 를 설치하려면 helm install 명령어를 사용하는 게 제일 쉽습니다. 설치전에 최신 차트 정보를 가져오기 위해 update 명령어를 먼저 실행합니다.

$ helm repo update
BASH


install 명령으로 비트나미의 mariadb 차트를 설치합니다.

정상적으로 구동되면 차트 name 과 버전, 접속 방법등 상세 정보를 표시합니다.

$ helm install bitnami/mariadb --generate-name

NAME: mariadb-1641174600
LAST DEPLOYED: Sun Jan  2 20:50:01 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: mariadb
CHART VERSION: 10.2.0
APP VERSION: 10.5.13

** Please be patient while the chart is being deployed **

Tip:

  Watch the deployment status using the command: kubectl get pods -w --namespace default -l app.kubernetes.io/instance=mariadb-1641174600

Services:

  echo Primary: mariadb-1641174600.default.svc.cluster.local:3306

Administrator credentials:

  Username: root
  Password : $(kubectl get secret --namespace default mariadb-1641174600 -o jsonpath="{.data.mariadb-root-password}" | base64 --decode)

To connect to your database:

  1. Run a pod that you can use as a client:

      kubectl run mariadb-1641174600-client --rm --tty -i --restart='Never' --image  docker.io/bitnami/mariadb:10.5.13-debian-10-r32 --namespace default --command -- bash

  2. To connect to primary service (read/write):

      mysql -h mariadb-1641174600.default.svc.cluster.local -uroot -p my_database
BASH


차트 설치가 끝났으면 show chart 로 차트 정보를 확인할 수 있습니다.

$ helm show chart bitnami/mariadb

annotations:
  category: Database
apiVersion: v2
appVersion: 10.5.13
BASH


같이 보기

Ref