본문 바로가기

Container/Kubernetes

[K8S] Lifecycle management with Helm

  • 릴리즈는 모두 동일한 차트를 기반으로 하더라도 독립적으로 관리될 수 있다.
  • 오브젝트 트래킹: Helm은 각 릴리스에 속한 Kubernetes 오브젝트(예: Deployment, Service, ConfigMap 등)를 추적한다. 이 추적 기능 덕분에, 특정 릴리스에 속한 오브젝트만을 대상으로 업그레이드, 다운그레이드, 제거 같은 작업을 수행할 수 있다.
  • 격리된 작업: Helm은 특정 릴리스와 관련된 오브젝트만 변경하므로, 다른 릴리스에 속한 오브젝트에 영향을 주지 않는다. 이는 여러 애플리케이션이 같은 클러스터에서 독립적으로 관리될 수 있음을 의미한다.
$  helm install nginx-release bitnami/nginx --version 19.0.0
Pulled: us-central1-docker.pkg.dev/kk-lab-prod/helm-charts/bitnami/nginx:19.0.0
Digest: sha256:e01e0935b7d0e4739c67897bc9205f5c1eb3b857d22629b6b3abaa3f4429d42f
NAME: nginx-release
LAST DEPLOYED: Fri Feb 21 08:40:31 2025
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: nginx
CHART VERSION: 19.0.0
APP VERSION: 1.27.4


$ kubectl get pods
NAME                                 READY   STATUS    RESTARTS   AGE
amaze-surf-apache-5b887874f7-b4gfh   1/1     Running   0          15m
crazy-web-nginx-55d766f755-5l5bw     1/1     Running   0          14m
nginx-release-566568d688-rss5m       1/1     Running   0          70s

# nginx-19.0.0 돌아가고 있는 것 확인 (revision 1)
$ kubectl describe pod nginx-release-566568d688-rss5m
Name:             nginx-release-566568d688-rss5m
Namespace:        default
Priority:         0
Service Account:  nginx-release
Node:             controlplane/192.168.63.181
Start Time:       Fri, 21 Feb 2025 08:40:32 +0000
Labels:           app.kubernetes.io/instance=nginx-release
                  app.kubernetes.io/managed-by=Helm
                  app.kubernetes.io/name=nginx
                  app.kubernetes.io/version=1.27.4
                  helm.sh/chart=nginx-19.0.0
                  pod-template-hash=566568d688
Annotations:      cni.projectcalico.org/containerID: 25bd3a62e7efc70b878446e00aede132042884da616fb05a47f105bb4be2328d
                  cni.projectcalico.org/podIP: 172.17.0.8/32
                  cni.projectcalico.org/podIPs: 172.17.0.8/32
Status:           Running

 

  • Helm Upgrade
# Upgrade (revision 2)
$ helm upgrade nginx-release bitnami/nginx
Pulled: us-central1-docker.pkg.dev/kk-lab-prod/helm-charts/bitnami/nginx:19.0.0
Digest: sha256:e01e0935b7d0e4739c67897bc9205f5c1eb3b857d22629b6b3abaa3f4429d42f
Release "nginx-release" has been upgraded. Happy Helming!
NAME: nginx-release
LAST DEPLOYED: Fri Feb 21 08:49:07 2025
NAMESPACE: default
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
CHART NAME: nginx
CHART VERSION: 19.0.0
APP VERSION: 1.27.4

Retagged images:
  - docker.io/bitnami/nginx:1.27.4-debian-12-r1

$ kubectl get pods
NAME                                 READY   STATUS    RESTARTS   AGE
amaze-surf-apache-5b887874f7-b4gfh   1/1     Running   0          24m
crazy-web-nginx-55d766f755-5l5bw     1/1     Running   0          23m
nginx-release-566568d688-rss5m       1/1     Running   0          9m39s

$ helm history nginx-release
REVISION        UPDATED                         STATUS          CHART            APP VERSION     DESCRIPTION     
1               Fri Feb 21 08:40:31 2025        superseded      nginx-19.0.0     1.27.4          Install complete
2               Fri Feb 21 08:49:07 2025        deployed        nginx-19.0.0     1.27.4          Upgrade complete

 

  • Helm rollback
$ helm rollback nginx-release 1
Rollback was a success! Happy Helming!

$ helm history nginx-release
REVISION        UPDATED                         STATUS          CHART            APP VERSION     DESCRIPTION     
1               Fri Feb 21 08:40:31 2025        superseded      nginx-19.0.0     1.27.4          Install complete
2               Fri Feb 21 08:49:07 2025        superseded      nginx-19.0.0     1.27.4          Upgrade complete
3               Fri Feb 21 08:54:44 2025        deployed        nginx-19.0.0     1.27.4          Rollback to 1

 

반응형

'Container > Kubernetes' 카테고리의 다른 글

[K8S]Kustomize  (1) 2025.02.21
[K8S] Upgrading a helm chart - kodekloud 실습  (0) 2025.02.21
[K8S] Helm  (0) 2025.02.20
[K8S] Troubleshoot Network 예제  (0) 2025.02.12
[K8S] Kubectl - jsonpath  (0) 2025.02.10