> For the complete documentation index, see [llms.txt](https://kubernetes.youngwjung.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kubernetes.youngwjung.com/extras/helm/lab.md).

# 실습

### Introduction

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

   ```
   helm version
   ```
2. Helm이 설치되저 있지 않을 경우 Helm 설치&#x20;

   ```
   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. 리포지토리 목록 확인&#x20;

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

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

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

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

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

    ```
    {
        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. 리포지토리 목록 확인&#x20;

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

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

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

    ```
    helm repo list
    ```
19. ArgoCD 차트 설치 방법 확인 - <https://artifacthub.io/packages/helm/argo/argo-cd?modal=install>
20. ArgoCD 차트를 설치할 Namespace 생성&#x20;

    ```
    kubectl create ns argocd
    ```
21. ArgoCD 차트 설치&#x20;

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

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

    ```
    helm list --all-namespaces
    ```
24. 생성된 객체 확인&#x20;

    ```
    kubectl get all -n argocd
    ```
25. ArgoCD 차트에 포함된 템플릿 확인 - <https://artifacthub.io/packages/helm/argo/argo-cd?modal=template>
26. 차트 설치(업그레이드)에 사용된 변수 확인

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

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

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

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

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

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

    ```
    helm get manifest argo-cd -n argocd
    ```
33. Helm 차트 삭제&#x20;

    ```
    helm uninstall argo-cd -n argocd
    ```
34. 쿠버네티스 객체도 같이 삭제되었는지 확인&#x20;

    ```
    kubectl get all -n argocd
    ```
35. Argocd 설치에 사용한 리포지토리의 인덱스 파일 확인 &#x20;

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

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

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

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

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

    ```
    ls ~/.cache/helm/repository
    ```
41. 차트 다운로드&#x20;

    ```
    wget $(yq '.entries.argo-cd[0].urls[0]' index.yaml) -O argocd.tgz
    ```
42. 차트 설치&#x20;

    ```
    helm install argo-cd ./argocd.tgz -n argocd
    ```
43. 설치된 Helm 차트(release) 목록 확인&#x20;

    ```
    helm list -n argocd
    ```
44. Helm 차트가 설치된 네임스페이스에 있는 Secret 객체 확인&#x20;

    ```
    kubectl get secret -n argocd 
    ```
45. `helm.sh/release.v1` 유형의 Secret 내용 확인&#x20;

    ```
    kubectl describe secrets sh.helm.release.v1.argo-cd.v1 -n argocd
    ```
46. Data에 저장된 내용 확인&#x20;

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

    ```
    kubectl delete secrets sh.helm.release.v1.argo-cd.v1 -n argocd
    ```
48. 설치된 Helm 차트(release) 목록 확인&#x20;

    ```
    helm list -n argocd
    ```
49. 생성된 Pod 목록 확인&#x20;

    ```
    kubectl get pod -n argocd
    ```
50. Helm 차트 재설치&#x20;

    ```
    helm install argo-cd ./argocd.tgz -n argocd
    ```
51. Pod들이 새로 생성되었는지 확인&#x20;

    ```
    kubectl get pod -n argocd
    ```
52. Helm 배포 삭제&#x20;

    ```
    helm uninstall argo-cd -n argocd
    ```
53. 리소스가 삭제 되었는지 확인&#x20;

    ```
    kubectl get all -n argocd
    ```
54. 설치된 Helm 차트(release) 목록 확인&#x20;

    ```
    helm list -A
    ```
55. Namespace 삭제&#x20;

    ```
    kubectl delete ns argocd
    ```

### Helm charts - Part 1

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

   ```
   mkdir my-app && cd my-app
   ```
2. Chart.yaml 파일 생성&#x20;

   ```
   cat > Chart.yaml <<EOF
   name: my-app
   version: 1.0.0
   EOF
   ```
3. 차트에 포함될 YAML 파일을 저장할 디렉토리 생성

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

   ```
   cat > templates/configmap.yaml <<EOF
   apiVersion: v1
   kind: ConfigMap
   metadata:
     name: my-app
     labels:
       app: my-app
   data:
     index.html: |
       hello my-app
   EOF
   ```
5. ServiceAccount를 명시할 YAML 파일 생성

   ```
   cat > templates/serviceaccount.yaml <<EOF
   apiVersion: v1
   kind: ServiceAccount
   metadata:
     name: my-app
     labels:
       app: my-app
   EOF
   ```
6. Deployment를 명시할 YAML 파일 생성

   ```
   cat > templates/deployment.yaml <<EOF
   apiVersion: apps/v1
   kind: Deployment
   metadata:
     name: my-app
     labels:
       app: my-app
   spec:
     replicas: 1
     selector:
       matchLabels:
         app: my-app
     template:
       metadata:
         labels:
           app: my-app
       spec:
         serviceAccountName: my-app
         containers:
         - name: my-app
           image: nginx
           ports:
           - containerPort: 80
           volumeMounts:
           - name: html
             mountPath: /usr/share/nginx/html
         volumes:
         - name: html
           configMap:
             name: my-app
   EOF
   ```
7. Service를 명시할 YAML 파일 생성

   ```
   cat > templates/service.yaml <<EOF
   apiVersion: v1
   kind: Service
   metadata:
     name: my-app
     labels:
       app: my-app
   spec:
     ports:
     - port: 80
       targetPort: 80
     selector:
       app: my-app
   EOF
   ```
8. *templates* 디렉토리 안에 생성된 파일 확인

   ```
   ls templates
   ```
9. 차트 배포&#x20;

   ```
   helm install my-app .
   ```
10. 배포된 차트 목록 확인&#x20;

    ```
    helm ls
    ```
11. 생성된 리소스 확인

    ```
    kubectl get svc,deploy,cm,sa -l app=my-app
    ```
12. Helm을 통해서 생성된 리소스에 부여된 Label 확인

    ```
    kubectl get svc,deploy,cm,sa -l app=my-app --show-labels
    ```
13. 데모 애플리케이션이 정상적으로 배포되었는지 확인&#x20;

    ```
    kubectl run nginx --image=nginx -it --rm --restart=Never -- curl my-app 
    ```
14. *deployment.yaml* 파일에 명시된 *replicas* 확인

    ```
    cat templates/deployment.yaml | grep replicas
    ```
15. *replicas*의 값을 3으로 변경

    ```
    sed -i 's/replicas: .*/replicas: 3/' templates/deployment.yaml
    ```
16. replicas의 값이 변경되었는지 확인

    ```
    cat templates/deployment.yaml | grep replicas
    ```
17. 위에서 수정한 변경분을 반영

    ```
    helm upgrade my-app .
    ```
18. 생성된 Deployment의 Replica 갯수 확인

    ```
    kubectl get deploy -l app=my-app
    ```
19. Pod 갯수 확인&#x20;

    ```
    kubectl get pod -l app=my-app
    ```
20. 배포된 차트의 기록 확인&#x20;

    ```
    helm history my-app
    ```
21. 이번 버전으로 롤백&#x20;

    ```
    helm rollback my-app 1
    ```
22. 생성된 Deployment의 Replica 갯수 확인

    ```
    kubectl get deploy -l app=my-app
    ```
23. Pod 갯수 확인&#x20;

    ```
    kubectl get pod -l app=my-app
    ```
24. 배포된 차트의 기록 확인&#x20;

    ```
    helm history my-app
    ```
25. Helm 배포 삭제&#x20;

    ```
    helm uninstall my-app
    ```
26. 리소스가 삭제 되었는지 확인&#x20;

    ```
    kubectl get svc,deploy,cm,sa -l app=my-app
    ```
27. 배포된 차트 목록 확인&#x20;

    ```
    helm ls
    ```
28. 차트에 주입할 파라미터들의 기본값들을 명시할 *values.yaml* 파일 생성&#x20;

    ```
    cat > values.yaml <<EOF
    # Default values for my-app.
    # This is a YAML-formatted file.
    # Declare variables to be passed into your templates.

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

    ```
    cat >> values.yaml <<EOF
    replicaCount: 2

    EOF
    ```
30. Deployment를 명시한 YAML 파일 수정&#x20;

    ```
    cat > templates/deployment.yaml <<EOF
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: my-app
      labels:
        app: my-app
    spec:
      replicas: {{ .Values.replicaCount }}
      selector:
        matchLabels:
          app: my-app
      template:
        metadata:
          labels:
            app: my-app
        spec:
          serviceAccountName: my-app
          containers:
          - name: my-app
            image: nginx
            ports:
            - containerPort: 80
            volumeMounts:
            - name: html
              mountPath: /usr/share/nginx/html
          volumes:
          - name: html
            configMap:
              name: my-app
    EOF
    ```
31. 차트 배포&#x20;

    ```
    helm install my-app .
    ```
32. 생성된 Deployment의 Replica 갯수 확인

    ```
    kubectl get deploy -l app=my-app
    ```
33. *replicaCount*를 Helm 명령어에 파라미터로 명시하고 차트 업그레이드&#x20;

    ```
    helm upgrade my-app . --set replicaCount=5
    ```
34. Deployment의 Replica 갯수 확인

    ```
    kubectl get deploy -l app=my-app
    ```
35. *values\_dev.yaml* 이라는 이름으로 파일을 생성하고 변수 명시&#x20;

    ```
    cat >> values_dev.yaml <<EOF
    replicaCount: 1

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

    ```
    helm upgrade my-app . -f values_dev.yaml
    ```
37. Deployment의 Replica 갯수 확인

    ```
    kubectl get deploy -l app=my-app
    ```
38. 차트 삭제&#x20;

    ```
    {
        helm uninstall my-app
        cd ~/environment
    }
    ```

### Helm charts - Part 2&#x20;

1. Helm 차트 생성 &#x20;

   ```
   {
       helm create frontend
       cd frontend
   }
   ```
2. 생성된 차트 내용 확인&#x20;

   ```
   {
       cat Chart.yaml
       cat values.yaml
       ls templates
   }
   ```
3. NGINX 애플리케이션 배포에 사용할 변수 생성&#x20;

   ```
   cat >> nginx_dev.yaml <<EOF
   image:
     repository: nginx
   replicaCount: 2
   EOF
   ```
4. Apache 애플리케이션 배포에 사용할 변수 파일 생성&#x20;

   ```
   cat >> httpd_dev.yaml <<EOF
   image:
     repository: httpd
     tag: latest
   EOF
   ```
5. 위에서 생성한 Helm 차트와 변수 파일을 통해서 NGINX 애플리케이션 배포&#x20;

   ```
   helm install nginx . -f nginx_dev.yaml
   ```
6. 위에서 생성한 Helm 릴리즈를 통해서 생성된 객체 확인&#x20;

   ```
   kubectl get all \
   -l='app.kubernetes.io/managed-by=Helm,app.kubernetes.io/instance=nginx'
   ```
7. 위에서 생성한 Helm 차트와 변수 파일을 통해서 Apache 애플리케이션 배포

   ```
   helm install httpd . -f httpd_dev.yaml
   ```
8. 위에서 생성한 Helm 릴리즈를 통해서 생성된 객체 확인&#x20;

   ```
   kubectl get all \
   -l='app.kubernetes.io/managed-by=Helm,app.kubernetes.io/instance=httpd'
   ```
9. 배포된 애플리케이션 목록 확인&#x20;

   ```
   helm ls
   ```
10. 애플리케이션 삭제&#x20;

    ```
    helm uninstall nginx httpd
    ```
11. 위에서 생성한 Helm 차트를 GitHub 리포지토리에 업로드 - <https://github.com/youngwjung/helm-chart-frontend>
12. ArgoCD 설치&#x20;

    ```
    {
        kubectl create ns argocd
        helm install argo-cd argo/argo-cd -n argocd \
        --set server.service.type=LoadBalancer \
        --set configs.params."server\.insecure"=true
    }
    ```
13. ArgoCD 어드민 비밀번호 확인&#x20;

    ```
    kubectl -n argocd get secret argocd-initial-admin-secret \
    -o jsonpath="{.data.password}" | base64 -d
    ```
14. ArgoCD 접속 URL 확인 후 ArgoCD에 로그인

    ```
    kubectl -n argocd get svc argo-cd-argocd-server \
    -o=jsonpath='{.status.loadBalancer.ingress[0].hostname}{"\n"}'
    ```
15. ArgoCD 애플리케이션 생성 - NGINX

    ```
    cat <<EOF | kubectl apply -f -
    apiVersion: argoproj.io/v1alpha1
    kind: Application
    metadata:
      name: nginx
      namespace: argocd
      finalizers:
      - resources-finalizer.argocd.argoproj.io
    spec:
      project: default
      source:
        repoURL: https://github.com/youngwjung/helm-chart-frontend.git
        targetRevision: HEAD
        path: .
        helm:
          valueFiles: 
          - nginx_dev.yaml
      destination:
        name: in-cluster
        namespace: default
      syncPolicy:
        automated:
          prune: true
    EOF
    ```
16. ArgoCD에서 애플리케이션이 정상 생성되었는지 확인&#x20;
17. ArgoCD 애플리케이션 생성 - Apache

    ```
    cat <<EOF | kubectl apply -f -
    apiVersion: argoproj.io/v1alpha1
    kind: Application
    metadata:
      name: httpd
      namespace: argocd
      finalizers:
      - resources-finalizer.argocd.argoproj.io
    spec:
      project: default
      source:
        repoURL: https://github.com/youngwjung/helm-chart-frontend.git
        targetRevision: HEAD
        path: .
        helm:
          valueFiles: 
          - httpd_dev.yaml
      destination:
        name: in-cluster
        namespace: default
      syncPolicy:
        automated:
          prune: true
    EOF
    ```
18. ArgoCD에서 애플리케이션이 정상 생성되었는지 확인&#x20;
19. templates 디렉토리 하위에 있는 deployment.yaml 파일을 아래와 같이 수정하고 커밋&#x20;

    ```
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: {{ include "frontend.fullname" . }}-edited
      labels:
        {{- include "frontend.labels" . | nindent 4 }}
    spec:
      {{- if not .Values.autoscaling.enabled }}
      replicas: {{ .Values.replicaCount }}
      {{- end }}
      selector:
        matchLabels:
          {{- include "frontend.selectorLabels" . | nindent 6 }}
      template:
        metadata:
          {{- with .Values.podAnnotations }}
          annotations:
            {{- toYaml . | nindent 8 }}
          {{- end }}
          labels:
            {{- include "frontend.labels" . | nindent 8 }}
            {{- with .Values.podLabels }}
            {{- toYaml . | nindent 8 }}
            {{- end }}
        spec:
          {{- with .Values.imagePullSecrets }}
          imagePullSecrets:
            {{- toYaml . | nindent 8 }}
          {{- end }}
          serviceAccountName: {{ include "frontend.serviceAccountName" . }}
          securityContext:
            {{- toYaml .Values.podSecurityContext | nindent 8 }}
          containers:
            - name: {{ .Chart.Name }}
              securityContext:
                {{- toYaml .Values.securityContext | nindent 12 }}
              image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
              imagePullPolicy: {{ .Values.image.pullPolicy }}
              ports:
                - name: http
                  containerPort: {{ .Values.service.port }}
                  protocol: TCP
              livenessProbe:
                {{- toYaml .Values.livenessProbe | nindent 12 }}
              readinessProbe:
                {{- toYaml .Values.readinessProbe | nindent 12 }}
              resources:
                {{- toYaml .Values.resources | nindent 12 }}
              {{- with .Values.volumeMounts }}
              volumeMounts:
                {{- toYaml . | nindent 12 }}
              {{- end }}
          {{- with .Values.volumes }}
          volumes:
            {{- toYaml . | nindent 8 }}
          {{- end }}
          {{- with .Values.nodeSelector }}
          nodeSelector:
            {{- toYaml . | nindent 8 }}
          {{- end }}
          {{- with .Values.affinity }}
          affinity:
            {{- toYaml . | nindent 8 }}
          {{- end }}
          {{- with .Values.tolerations }}
          tolerations:
            {{- toYaml . | nindent 8 }}
          {{- end }}
    ```
20. 수정 사항이 각각의 애플리케이션에 반영 되었는지 확인&#x20;
21. ArgoCD에 생성한 애플리케이션 삭제&#x20;

    ```
    kubectl delete application nginx httpd -n argocd
    ```
22. 애플리케이션 변수 파일을 저장할 디렉토리를 생성하고 변수 파일을 이동

    ```
    {
        mkdir ~/environment/frontend-values
        mv nginx_dev.yaml httpd_dev.yaml ~/environment/frontend-values
    }
    ```
23. GitHub 리포지토리를 생성하고 변수 파일들을 업로드 - <https://github.com/youngwjung/helm-chart-frontend-values>
24. Chart.yaml을 열고 버전을 1.0.0으로 수정&#x20;
25. Helm 차트 패키지 생성

    ```
    helm package .
    ```
26. Helm 차트를 저장할 ECR 리포지토리 생성&#x20;

    ```
    aws ecr create-repository --repository-name helm-charts/frontend
    ```
27. ECR 리포지토리 로그인&#x20;

    ```
    aws ecr get-login-password --region ap-northeast-2 | 
    helm registry login \
    --username AWS \
    --password-stdin 491818659652.dkr.ecr.ap-northeast-2.amazonaws.com
    ```
28. Helm 차트 업로드&#x20;

    ```
    helm push frontend-1.0.0.tgz \
    oci://491818659652.dkr.ecr.ap-northeast-2.amazonaws.com/helm-charts
    ```
29. 차트가 정상적으로 업로드 되었는지 확인&#x20;

    ```
    aws ecr describe-images \
    --repository-name helm-charts/frontend \
    --region ap-northeast-2
    ```
30. ArgoCD에 ECR 리포지토리 자격증명 등록&#x20;

    ```
    cat <<EOF | kubectl apply -f -
    apiVersion: v1
    kind: Secret
    metadata:
      name: ecr-helm
      namespace: argocd
      labels:
        argocd.argoproj.io/secret-type: repository
    stringData:
      type: helm
      url: 491818659652.dkr.ecr.ap-northeast-2.amazonaws.com
      name: ecr-helm
      username: AWS
      password: $(aws ecr get-login-password --region ap-northeast-2)
    EOF
    ```
31. ArgoCD 애플리케이션 생성 - NGINX

    ```
    cat <<EOF | kubectl apply -f -
    apiVersion: argoproj.io/v1alpha1
    kind: Application
    metadata:
      name: nginx
      namespace: argocd
      finalizers:
      - resources-finalizer.argocd.argoproj.io
    spec:
      project: default
      sources:
      - repoURL: 491818659652.dkr.ecr.ap-northeast-2.amazonaws.com
        chart: helm-charts/frontend
        targetRevision: 1.0.0
        helm:
          valueFiles: 
          - \$values/nginx_dev.yaml
      - repoURL: https://github.com/youngwjung/helm-chart-frontend-values.git
        targetRevision: HEAD
        ref: values
      destination:
        name: in-cluster
        namespace: default
      syncPolicy:
        automated:
          prune: true
    EOF
    ```
32. ArgoCD에서 애플리케이션이 정상 생성되었는지 확인&#x20;
33. ArgoCD 애플리케이션 생성 - Apache

    ```
    cat <<EOF | kubectl apply -f -
    apiVersion: argoproj.io/v1alpha1
    kind: Application
    metadata:
      name: httpd
      namespace: argocd
      finalizers:
      - resources-finalizer.argocd.argoproj.io
    spec:
      project: default
      sources:
      - repoURL: 491818659652.dkr.ecr.ap-northeast-2.amazonaws.com
        chart: helm-charts/frontend
        targetRevision: 1.0.0
        helm:
          valueFiles: 
          - \$values/httpd_dev.yaml
      - repoURL: https://github.com/youngwjung/helm-chart-frontend-values.git
        targetRevision: HEAD
        ref: values
      destination:
        name: in-cluster
        namespace: default
      syncPolicy:
        automated:
          prune: true
    EOF
    ```
34. ArgoCD에서 애플리케이션이 정상 생성되었는지 확인&#x20;
35. templates 디렉토리 하위에 있는 deployment.yaml 파일을 아래와 같이 수정

    ```
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: {{ include "frontend.fullname" . }}-edited
      labels:
        {{- include "frontend.labels" . | nindent 4 }}
    spec:
      {{- if not .Values.autoscaling.enabled }}
      replicas: {{ .Values.replicaCount }}
      {{- end }}
      selector:
        matchLabels:
          {{- include "frontend.selectorLabels" . | nindent 6 }}
      template:
        metadata:
          {{- with .Values.podAnnotations }}
          annotations:
            {{- toYaml . | nindent 8 }}
          {{- end }}
          labels:
            {{- include "frontend.labels" . | nindent 8 }}
            {{- with .Values.podLabels }}
            {{- toYaml . | nindent 8 }}
            {{- end }}
        spec:
          {{- with .Values.imagePullSecrets }}
          imagePullSecrets:
            {{- toYaml . | nindent 8 }}
          {{- end }}
          serviceAccountName: {{ include "frontend.serviceAccountName" . }}
          securityContext:
            {{- toYaml .Values.podSecurityContext | nindent 8 }}
          containers:
            - name: {{ .Chart.Name }}
              securityContext:
                {{- toYaml .Values.securityContext | nindent 12 }}
              image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
              imagePullPolicy: {{ .Values.image.pullPolicy }}
              ports:
                - name: http
                  containerPort: {{ .Values.service.port }}
                  protocol: TCP
              livenessProbe:
                {{- toYaml .Values.livenessProbe | nindent 12 }}
              readinessProbe:
                {{- toYaml .Values.readinessProbe | nindent 12 }}
              resources:
                {{- toYaml .Values.resources | nindent 12 }}
              {{- with .Values.volumeMounts }}
              volumeMounts:
                {{- toYaml . | nindent 12 }}
              {{- end }}
          {{- with .Values.volumes }}
          volumes:
            {{- toYaml . | nindent 8 }}
          {{- end }}
          {{- with .Values.nodeSelector }}
          nodeSelector:
            {{- toYaml . | nindent 8 }}
          {{- end }}
          {{- with .Values.affinity }}
          affinity:
            {{- toYaml . | nindent 8 }}
          {{- end }}
          {{- with .Values.tolerations }}
          tolerations:
            {{- toYaml . | nindent 8 }}
          {{- end }}
    ```
36. Chart.yaml을 열고 버전을 1.0.1으로 수정&#x20;
37. Helm 차트 패키지 생성

    ```
    {
        rm *.tgz
        helm package .
    }
    ```
38. Helm 차트 업로드&#x20;

    ```
    helm push frontend-1.0.1.tgz \
    oci://491818659652.dkr.ecr.ap-northeast-2.amazonaws.com/helm-charts
    ```
39. 차트가 정상적으로 업로드 되었는지 확인&#x20;

    ```
    aws ecr describe-images \
    --repository-name helm-charts/frontend \
    --region ap-northeast-2
    ```
40. ArgoCD UI에서 Apache 애플리케이션의 차트 버전을 1.0.1로 수정
41. 애플리케이션이 정상 업그레이드 되는지 확인&#x20;
42. 리소스 삭제&#x20;

    ```
    {
        kubectl delete application nginx httpd -n argocd
        helm uninstall argo-cd -n argocd
        kubectl delete ns argocd
        aws ecr delete-repository --repository-name helm-charts/frontend --force
    }
    ```
