실습

Introduction

  1. Helm이 설치되어 있는지 확인

    helm version
  2. Helm이 설치되저 있지 않을 경우 Helm 설치

    curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
  3. Helm 명령어 목록 확인 - https://helm.sh/docs/helm/helm/

  4. Helm 명령어를 통해서 Artifact Hub에 등록된 차트중에서 ArgoCD 차트 검색

    helm search hub argocd
  5. Artifact Hub 사이트에서 ArgoCD 차트 검색 - https://artifacthub.io/

  6. Google을 통해서 ArgoCD Helm 차트 검색 - https://www.google.com/search?q=argocd+helm+chart

  7. ArgoCD 차트가 저장되어져 있는 리포지토리 추가

    helm repo add argo https://argoproj.github.io/argo-helm
  8. 리포지토리 목록 확인

    helm repo list
  9. 위에서 추가한 리포지토리에서 제공하는 차트 목록 확인

    helm search repo argo
  10. Helm 리포지토리 정보가 저장된 파일 확인

    {
        ls ~/.config/helm/
        cat ~/.config/helm/repositories.yaml
    }
  11. 위에서 추가한 리포지토리에서 제공하는 차트 정보가 저장된 파일 확인

    {
        cat ~/.cache/helm/repository/argo-index.yaml
        ls ~/.cache/helm/repository
    }
  12. 리포지토리 삭제

    helm repo remove argo
  13. 리포지토리 및 차트 정보가 저장된 파일이 같이 삭제 되었는지 확인

    {
        ll ~/.config/helm/
        cat ~/.config/helm/repositories.yaml
        ll ~/.cache/helm/repository
    }
  14. ArgoCD 차트가 저장되어져 있는 리포지토리 추가

    helm repo add argoo https://argoproj.github.io/argo-helm
  15. 리포지토리 목록 확인

    helm repo list
  16. 위에서 추가한 리포지토리에서 제공하는 차트 목록 확인

    helm search repo argoo
  17. 리포지토리 및 차트 정보가 저장된 파일을 강제로 삭제

    {
        rm ~/.config/helm/*
        rm ~/.cache/helm/repository/*
    }
  18. 리포지토리 목록 확인

    helm repo list
  19. ArgoCD 차트를 설치할 Namespace 생성

    kubectl create ns argocd
  20. ArgoCD 차트 설치

    {
        helm repo add argo https://argoproj.github.io/argo-helm
        helm install argo-cd argo/argo-cd --namespace argocd
    }
  21. 설치된 Helm 차트(release) 목록 확인

    helm list
  22. 모든 네임스페이스에 생성된 Helm 배포 목록 확인

    helm list --all-namespaces
  23. 생성된 객체 확인

    kubectl get all -n argocd
  24. ArgoCD 차트에 포함된 템플릿 확인 - https://artifacthub.io/packages/helm/argo/argo-cd?modal=template

  25. 차트 설치(업그레이드)에 사용된 변수 확인

    helm get values argo-cd -n argocd
  26. 차트에 적용된 기본 변수 확인 - https://artifacthub.io/packages/helm/argo/argo-cd?modal=values

    helm show values argo/argo-cd
  27. ArgoCD 서버의 서비스 유형을 LoadBalacer로 변경해서 차트 업그레이드

    helm upgrade argo-cd argo/argo-cd --set server.service.type=LoadBalancer -n argocd 
  28. ArgoCD 서버의 서비스 유형이 변경되었는지 확인

    kubectl get svc -n argocd
  29. 차트 설치(업그레이드) 할때 덮어쓰기된 변수 확인

    helm get values argo-cd -n argocd
  30. 차트 설치(업그레이드)에 사용된 변수 확인

    helm get values argo-cd --all -n argocd | less
  31. 차트 설치(업그레이드)에 사용된 쿠버네티스 객체 명세 파일(Manifest) 확인

    helm get manifest argo-cd -n argocd
  32. Helm 차트 삭제

    helm uninstall argo-cd -n argocd
  33. 쿠버네티스 객체도 같이 삭제되었는지 확인

    kubectl get all -n argocd
  34. Argocd 설치에 사용한 리포지토리의 인덱스 파일 확인

    cat ~/.cache/helm/repository/argo-index.yaml
  35. Argocd 설치에 사용한 리포지토리의 인덱스 파일 다운로드

    wget https://argoproj.github.io/argo-helm/index.yaml
  36. 위의 2개 파일 비교

    diff ~/.cache/helm/repository/argo-index.yaml index.yaml -s
  37. 위에서 다운받은 인덱스 파일을 통해서 최신 버전의 ArgoCD 차트 정보 확인

    yq '.entries.argo-cd[0]' index.yaml
  38. 최신 버전의 ArgoCD 차트를 다운로드 받을수 있는 경로 확인

    yq '.entries.argo-cd[0].urls[0]' index.yaml
  39. 해당 차트가 로컬 캐시에 다운로드 되어져 있는지 확인

    ls ~/.cache/helm/repository
  40. 차트 다운로드

    wget $(yq '.entries.argo-cd[0].urls[0]' index.yaml) -O argocd.tgz
  41. 차트 설치

    helm install argo-cd ./argocd.tgz -n argocd
  42. 설치된 Helm 차트(release) 목록 확인

    helm list -n argocd
  43. Helm 차트가 설치된 네임스페이스에 있는 Secret 객체 확인

    kubectl get secret -n argocd 
  44. helm.sh/release.v1 유형의 Secret 내용 확인

    kubectl describe secrets sh.helm.release.v1.argo-cd.v1 -n argocd
  45. Data에 저장된 내용 확인

    kubectl get secrets sh.helm.release.v1.argo-cd.v1 \
    -o jsonpath='{.data.release}' -n argocd \
    | base64 -d | base64 -d | gzip -d | jq
  46. helm.sh/release.v1 유형의 Secret 삭제

    kubectl delete secrets sh.helm.release.v1.argo-cd.v1 -n argocd
  47. 설치된 Helm 차트(release) 목록 확인

    helm list -n argocd
  48. 생성된 Pod 목록 확인

    kubectl get pod -n argocd
  49. Helm 차트 재설치

    helm install argo-cd ./argocd.tgz -n argocd
  50. Pod들이 새로 생성되었는지 확인

    kubectl get pod -n argocd
  51. Helm 배포 삭제

    helm uninstall argo-cd -n argocd
  52. 리소스가 삭제 되었는지 확인

    kubectl get all -n argocd
  53. 설치된 Helm 차트(release) 목록 확인

    helm list -A
  54. Namespace 삭제

    kubectl delete ns argocd

Helm charts - Part 1

  1. Helm 차트를 저장할 디렉토리를 생성하고 해당 디렉토리로 이동

  2. Chart.yaml 파일 생성

  3. 차트에 포함될 YAML 파일을 저장할 디렉토리 생성

  4. ConfigMap을 명시할 YAML 파일 생성

  5. ServiceAccount를 명시할 YAML 파일 생성

  6. Deployment를 명시할 YAML 파일 생성

  7. Service를 명시할 YAML 파일 생성

  8. templates 디렉토리 안에 생성된 파일 확인

  9. 차트 배포

  10. 배포된 차트 목록 확인

  11. 생성된 리소스 확인

  12. Helm을 통해서 생성된 리소스에 부여된 Label 확인

  13. 데모 애플리케이션이 정상적으로 배포되었는지 확인

  14. deployment.yaml 파일에 명시된 replicas 확인

  15. replicas의 값을 3으로 변경

  16. replicas의 값이 변경되었는지 확인

  17. 위에서 수정한 변경분을 반영

  18. 생성된 Deployment의 Replica 갯수 확인

  19. Pod 갯수 확인

  20. 배포된 차트의 기록 확인

  21. 이번 버전으로 롤백

  22. 생성된 Deployment의 Replica 갯수 확인

  23. Pod 갯수 확인

  24. 배포된 차트의 기록 확인

  25. Helm 배포 삭제

  26. 리소스가 삭제 되었는지 확인

  27. 배포된 차트 목록 확인

  28. 차트에 주입할 파라미터들의 기본값들을 명시할 values.yaml 파일 생성

  29. Deployment에 명시할 replica 값을 values.yaml 파일에 변수로 지정

  30. Deployment를 명시한 YAML 파일 수정

  31. 차트 배포

  32. 생성된 Deployment의 Replica 갯수 확인

  33. replicaCount를 Helm 명령어에 파라미터로 명시하고 차트 업그레이드

  34. Deployment의 Replica 갯수 확인

  35. values_dev.yaml 이라는 이름으로 파일을 생성하고 변수 명시

  36. 위에서 생성한 파일을 Helm 명령어에 파라미터로 명시하고 차트 업그레이드

  37. Deployment의 Replica 갯수 확인

  38. 차트 삭제

Helm charts - Part 2

  1. Helm 차트 생성

  2. 생성된 차트 내용 확인

  3. NGINX 애플리케이션 배포에 사용할 변수 생성

  4. Apache 애플리케이션 배포에 사용할 변수 파일 생성

  5. 위에서 생성한 Helm 차트와 변수 파일을 통해서 NGINX 애플리케이션 배포

  6. 위에서 생성한 Helm 릴리즈를 통해서 생성된 객체 확인

  7. 위에서 생성한 Helm 차트와 변수 파일을 통해서 Apache 애플리케이션 배포

  8. 위에서 생성한 Helm 릴리즈를 통해서 생성된 객체 확인

  9. 배포된 애플리케이션 목록 확인

  10. 애플리케이션 삭제

  11. 위에서 생성한 Helm 차트를 GitHub 리포지토리에 업로드 - https://github.com/youngwjung/helm-chart-frontend

  12. ArgoCD 설치

  13. ArgoCD 어드민 비밀번호 확인

  14. ArgoCD 접속 URL 확인 후 ArgoCD에 로그인

  15. ArgoCD 애플리케이션 생성 - NGINX

  16. ArgoCD에서 애플리케이션이 정상 생성되었는지 확인

  17. ArgoCD 애플리케이션 생성 - Apache

  18. ArgoCD에서 애플리케이션이 정상 생성되었는지 확인

  19. templates 디렉토리 하위에 있는 deployment.yaml 파일을 아래와 같이 수정하고 커밋

  20. 수정 사항이 각각의 애플리케이션에 반영 되었는지 확인

  21. ArgoCD에 생성한 애플리케이션 삭제

  22. 애플리케이션 변수 파일을 저장할 디렉토리를 생성하고 변수 파일을 이동

  23. GitHub 리포지토리를 생성하고 변수 파일들을 업로드 - https://github.com/youngwjung/helm-chart-frontend-values

  24. Chart.yaml을 열고 버전을 1.0.0으로 수정

  25. Helm 차트 패키지 생성

  26. Helm 차트를 저장할 ECR 리포지토리 생성

  27. ECR 리포지토리 로그인

  28. Helm 차트 업로드

  29. 차트가 정상적으로 업로드 되었는지 확인

  30. ArgoCD에 ECR 리포지토리 자격증명 등록

  31. ArgoCD 애플리케이션 생성 - NGINX

  32. ArgoCD에서 애플리케이션이 정상 생성되었는지 확인

  33. ArgoCD 애플리케이션 생성 - Apache

  34. ArgoCD에서 애플리케이션이 정상 생성되었는지 확인

  35. templates 디렉토리 하위에 있는 deployment.yaml 파일을 아래와 같이 수정

  36. Chart.yaml을 열고 버전을 1.0.1으로 수정

  37. Helm 차트 패키지 생성

  38. Helm 차트 업로드

  39. 차트가 정상적으로 업로드 되었는지 확인

  40. ArgoCD UI에서 Apache 애플리케이션의 차트 버전을 1.0.1로 수정

  41. 애플리케이션이 정상 업그레이드 되는지 확인

  42. 리소스 삭제

Last updated