https://helm.sh/ko/docs/topics/charts/
https://helm.sh/docs/topics/charts/#the-chart-file-structure
https://artifacthub.io/ #헬름 차트를 모아놓은 곳
wordpress/
Chart.yaml # 차트에 대한 정보가 담긴 YAML
LICENSE # 차트의 라이선스 정보가 감긴 텍스트 파일
README.md # 해당 차트에 대한 설명을 포함한 README 파일
values.yaml # 차트의 기본 템플릿 변수 파일
charts/ # 차트에 종속된 차트들을 포함하는 디텍터리
crds/ # 커스텀 자원 정의
templates/ # values 파일과 같이 유효한 k8s 매니페스트 파일을 생성하는 템플릿 디렉터리
templates/NOTES.txt # 차트 사용법을 설명하는 텍스트 파일
## 리포지토리 목록 조회
[spkr@ubun20-01 ~ (⎈|ubun01:monitoring)]$ helm repo list
NAME URL
bitnami https://charts.bitnami.com/bitnami
prometheus-community https://prometheus-community.github.io/helm-charts
## 리포지토리 내 설치 가능한 애플리케이션 조회
[spkr@ubun20-01 ~ (⎈|ubun01:monitoring)]$ helm search repo bitnami
NAME CHART VERSION APP VERSION DESCRIPTION
bitnami/airflow 14.3.5 2.6.3 Apache Airflow is a tool to express and execute...
bitnami/apache 10.0.3 2.4.57 Apache HTTP Server is an open-source HTTP serve...
bitnami/apisix 2.0.8 3.4.1 Apache APISIX is high-performance, real-time AP...

# helm 유틸리티 설치
[spkr@ubun20-01 ~ (⎈|ubun01:monitoring)]$ curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
[spkr@ubun20-01 ~ (⎈|ubun01:monitoring)]$ chmod 700 get_helm.sh
[spkr@ubun20-01 ~ (⎈|ubun01:monitoring)]$ ./get_helm.sh
Helm v3.12.3 is already latest
[spkr@ubun20-01 ~ (⎈|ubun01:monitoring)]$ helm version
version.BuildInfo{Version:"v3.12.3", GitCommit:"3a31588ad33fe3b89af5a2a54ee1d25bfe6eaa5e", GitTreeState:"clean", GoVersion:"go1.20.7"}
# 헬름 리파지토리 추가
[spkr@ubun20-01 ~ (⎈|ubun01:monitoring)]$ helm repo add bitnami https://charts.bitnami.com/bitnami
"bitnami" already exists with the same configuration, skipping
[spkr@ubun20-01 ~ (⎈|ubun01:monitoring)]$ helm repo list
NAME URL
bitnami https://charts.bitnami.com/bitnami
prometheus-community https://prometheus-community.github.io/helm-charts
# 헬름 명령어를 사용해 nginx 헬름 차트 확인
[spkr@ubun20-01 ~ (⎈|ubun01:monitoring)]$ helm search repo nginx
NAME CHART VERSION APP VERSION DESCRIPTION
bitnami/nginx **15.1.2** 1.25.1 NGINX Open Source is a web server that can be a...
bitnami/nginx-ingress-controller 9.7.7 1.8.1 NGINX Ingress Controller is an Ingress controll...
bitnami/nginx-intel 2.1.15 0.4.9 DEPRECATED NGINX Open Source for Intel is a lig...
# 헬름 차트 다운로드
[spkr@ubun20-01 nginx (⎈|ubun01:monitoring)]$ helm pull bitnami/nginx
# 헬름 차트의 버전 관리 및 리소스 목록 확인
[spkr@ubun20-01 nginx (⎈|ubun01:monitoring)]$ tar xvfz nginx-15.1.2.tgz
nginx/Chart.yaml
nginx/Chart.lock
nginx/values.yaml
[spkr@ubun20-01 nginx (⎈|ubun01:monitoring)]$ rm -f nginx-15.1.2.tgz
[spkr@ubun20-01 nginx (⎈|ubun01:monitoring)]$ mv nginx/ nginx-15.1.2
[spkr@ubun20-01 nginx (⎈|ubun01:monitoring)]$ ll
total 12
drwxrwxr-x 3 spkr spkr 4096 Sep 6 16:22 ./
drwxr-xr-x 12 spkr spkr 4096 Sep 6 16:22 ../
drwxrwxr-x 4 spkr spkr 4096 Sep 6 16:22 nginx-15.1.2/
[spkr@ubun20-01 nginx (⎈|ubun01:monitoring)]$ cd nginx-15.1.2/
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:monitoring)]$ ll
total 124
drwxrwxr-x 4 spkr spkr 4096 Sep 6 16:22 ./
drwxrwxr-x 3 spkr spkr 4096 Sep 6 16:22 ../
-rw-r--r-- 1 spkr spkr 225 Jul 26 03:09 Chart.lock
drwxrwxr-x 3 spkr spkr 4096 Sep 6 16:22 charts/
-rw-r--r-- 1 spkr spkr 757 Jul 26 03:09 Chart.yaml
-rw-r--r-- 1 spkr spkr 333 Jul 26 03:09 .helmignore
-rw-r--r-- 1 spkr spkr 49246 Jul 26 03:09 README.md
drwxrwxr-x 2 spkr spkr 4096 Sep 6 16:22 templates/
-rw-r--r-- 1 spkr spkr 2225 Jul 26 03:09 values.schema.json
-rw-r--r-- 1 spkr spkr 36992 Jul 26 03:09 values.yaml
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:monitoring)]$ ls templates/
deployment.yaml health-ingress.yaml hpa.yaml NOTES.txt prometheusrules.yaml serviceaccount.yaml svc.yaml
extra-list.yaml _helpers.tpl ingress.yaml pdb.yaml server-block-configmap.yaml servicemonitor.yaml tls-secrets.yaml
# 템플릿 변수 파일 복사 및 수정
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:monitoring)]$ cp values.yaml my-values.yaml
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:monitoring)]$ vi my-values.yaml
## @param replicaCount Number of NGINX replicas to deploy
##
**replicaCount: 3**
## @param revisionHistoryLimit The number of old history to retain to allow rollback
##
revisionHistoryLimit: 10
## @param updateStrategy.type NGINX deployment strategy type
## @param updateStrategy.rollingUpdate NGINX deployment rolling update configuration parameters
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
##
updateStrategy:
type: RollingUpdate
# nginx 네임스페이스 생성
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:monitoring)]$ k create ns nginx
namespace/nginx created
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:monitoring)]$ k ns nginx
Context "ubun01" modified.
Active namespace is "nginx".
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:nginx)]$
# nginx 헬름 차트 설치
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:nginx)]$ helm install nginx -f my-values.yaml .
NAME: nginx
LAST DEPLOYED: Wed Sep 6 16:27:06 2023
NAMESPACE: nginx
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: nginx
CHART VERSION: 15.1.2
APP VERSION: 1.25.1
** Please be patient while the chart is being deployed **
NGINX can be accessed through the following DNS name from within your cluster:
nginx.nginx.svc.cluster.local (port 80)
To access NGINX from outside the cluster, follow the steps below:
1. Get the NGINX URL by running these commands:
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
Watch the status with: 'kubectl get svc --namespace nginx -w nginx'
export SERVICE_PORT=$(kubectl get --namespace nginx -o jsonpath="{.spec.ports[0].port}" services nginx)
export SERVICE_IP=$(kubectl get svc --namespace nginx nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "http://${SERVICE_IP}:${SERVICE_PORT}"
# 헬름 차트 설치 확인
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:nginx)]$ helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
nginx nginx 1 2023-09-06 16:27:06.022475464 +0000 UTC deployed nginx-15.1.2 1.25.1
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:nginx)]$ kgp
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-844f9bbbd9-9d6c5 1/1 Running 0 29s 10.233.109.147 ubun20-02 <none> <none>
nginx-844f9bbbd9-jrl5f 1/1 Running 0 29s 10.233.104.218 ubun20-01 <none> <none>
nginx-844f9bbbd9-l5n8s 1/1 Running 0 29s 10.233.70.21 ubun20-03 <none> <none>
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:nginx)]$ k get deploy,svc,configmap
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/nginx 3/3 3 3 51s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/nginx LoadBalancer 10.233.2.14 <pending> 80:31475/TCP 51s
NAME DATA AGE
configmap/kube-root-ca.crt 1 90s
**# 리소스 목록 확인과 개별 리소스 상세 옵션 확인 (디버깅 시)**
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:nginx)]$ helm get manifest nginx
---
# Source: nginx/templates/svc.yaml
apiVersion: v1
kind: Service
metadata:
name: nginx
namespace: "nginx"
labels:
app.kubernetes.io/name: nginx
helm.sh/chart: nginx-15.1.2
app.kubernetes.io/instance: nginx
app.kubernetes.io/managed-by: Helm
annotations:
spec:
type: LoadBalancer
sessionAffinity: None
externalTrafficPolicy: "Cluster"
ports:
- name: http
port: 80
targetPort: http
selector:
app.kubernetes.io/name: nginx
app.kubernetes.io/instance: nginx
---
# Source: nginx/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: "nginx"
labels:
app.kubernetes.io/name: nginx
helm.sh/chart: nginx-15.1.2
app.kubernetes.io/instance: nginx
app.kubernetes.io/managed-by: Helm
spec:
replicas: 3
revisionHistoryLimit: 10
strategy:
rollingUpdate: {}
type: RollingUpdate
selector:
matchLabels:
app.kubernetes.io/name: nginx
app.kubernetes.io/instance: nginx
template:
metadata:
labels:
app.kubernetes.io/name: nginx
helm.sh/chart: nginx-15.1.2
app.kubernetes.io/instance: nginx
app.kubernetes.io/managed-by: Helm
annotations:
spec:
automountServiceAccountToken: false
shareProcessNamespace: false
serviceAccountName: default
affinity:
podAffinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
app.kubernetes.io/name: nginx
app.kubernetes.io/instance: nginx
topologyKey: kubernetes.io/hostname
weight: 1
nodeAffinity:
hostNetwork: false
hostIPC: false
initContainers:
containers:
- name: nginx
image: docker.io/bitnami/nginx:1.25.1-debian-11-r39
imagePullPolicy: "IfNotPresent"
env:
- name: BITNAMI_DEBUG
value: "false"
- name: NGINX_HTTP_PORT_NUMBER
value: "8080"
envFrom:
ports:
- name: http
containerPort: 8080
livenessProbe:
failureThreshold: 6
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
tcpSocket:
port: http
readinessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 3
tcpSocket:
port: http
resources:
limits: {}
requests: {}
volumeMounts:
volumes:
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:nginx)]$ k describe pod nginx-844f9bbbd9-9d6c5 |grep -i liveness
Liveness: tcp-socket :http delay=30s timeout=5s period=10s #success=1 #failure=6
[spkr@ubun20-01 nginx-15.1.2 (⎈|ubun01:nginx)]$ k describe pod nginx-844f9bbbd9-9d6c5 |grep -i readiness
Readiness: tcp-socket :http delay=5s timeout=3s period=5s #success=1 #failure=3
[spkr@ubun20-01 ~ (⎈|ubun01:nginx)]$ curl -v 10.233.2.14
* Trying 10.233.2.14:80...
* TCP_NODELAY set
* Connected to 10.233.2.14 (10.233.2.14) port 80 (#0)
> GET / HTTP/1.1
> Host: 10.233.2.14
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK