Skip to content

2) Installing Argo Rollouts

Alex, Lee edited this page Jun 23, 2022 · 2 revisions

2022.04. 이장재 📧 [email protected] 📂 https://github.com/jangjaelee 📒 http://www.awx.kr


 

Prerequisites

 

Step 1. Argo Rollouts Installation

Manifest와 Helm을 사용한 두 가지 설치 방법이 있으며, 추가로 Argo CD Operator를 사용한 설치 방법도 알아보겠습니다.

  • using Manifest
  • using Helm
  • using Helm with Argo CD Operator

Step 1.1. using Manifest

$ kubectl create namespace argo-rollouts
namespace/argo-rollouts created

$ kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml
customresourcedefinition.apiextensions.k8s.io/analysisruns.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/analysistemplates.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/clusteranalysistemplates.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/experiments.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/rollouts.argoproj.io created
serviceaccount/argo-rollouts created
clusterrole.rbac.authorization.k8s.io/argo-rollouts created
clusterrole.rbac.authorization.k8s.io/argo-rollouts-aggregate-to-admin created
clusterrole.rbac.authorization.k8s.io/argo-rollouts-aggregate-to-edit created
clusterrole.rbac.authorization.k8s.io/argo-rollouts-aggregate-to-view created
clusterrolebinding.rbac.authorization.k8s.io/argo-rollouts created
secret/argo-rollouts-notification-secret created
service/argo-rollouts-metrics created
deployment.apps/argo-rollouts created

Web UI Dashboard를 위한 argo-rollouts-dashboard Deployment resource는 기본적으로 미포함으로, 설치가 필요하면 dashboard-install.yaml를 사용하여 설치 진행 합니다.

$ kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/dashboard-install.yaml
serviceaccount/argo-rollouts-dashboard created
clusterrole.rbac.authorization.k8s.io/argo-rollouts-dashboard created
clusterrolebinding.rbac.authorization.k8s.io/argo-rollouts-dashboard created
service/argo-rollouts-dashboard created
deployment.apps/argo-rollouts-dashboard created

$ kubectl get pod,deployment,svc -n argo-rollouts | egrep "NAME|argo-rollouts-dashboard"
NAME                                          READY   STATUS    RESTARTS   AGE
pod/argo-rollouts-dashboard-ff9668f57-hbg9m   1/1     Running   0          5m46s

NAME                                      READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/argo-rollouts-dashboard   1/1     1            1           5m46s

NAME                              TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
service/argo-rollouts-dashboard   ClusterIP   10.111.151.159   <none>        3100/TCP   5m46s

Step 1.2. using Helm

Web UI Dashboard를 위한 argo-rollouts-dashboard Deployment resource는 기본적으로 배포되지 않으므로 UI를 사용하고 싶으신 분은 --set dashboard.enabled=true 옵션을 반드지 지정하시기 바랍니다.

$ helm repo add argo https://argoproj.github.io/argo-helm
$ helm repo update

# argo rollouts의 helm chart 기본 values 파일 추출하고 추출한 파일을 본인의 환경에 맞게 수정
$ helm show values argo/argo-rollouts > argo-rollouts-values.yaml

$ helm install argo-rollouts argo/argo-rollouts -f argo-rollouts-values.yaml -n argo-rollouts --create-namespace --set dashboard.enabled=true
coalesce.go:220: warning: cannot overwrite table with non table for argo-rollouts.dashboard.ingress.annotations (map[])
NAME: argo-rollouts
LAST DEPLOYED: Mon Apr 11 16:50:22 2022
NAMESPACE: argo-rollouts
STATUS: deployed
REVISION: 1
TEST SUITE: None

$ kubectl get all -n argo-rollouts
NAME                                           READY   STATUS    RESTARTS      AGE
pod/argo-rollouts-555667ffc9-929c9             1/1     Running   0             4m40s
pod/argo-rollouts-555667ffc9-f7dq4             1/1     Running   0             4m40s
pod/argo-rollouts-dashboard-5878c84fb4-26g69   1/1     Running   0             4m40s

NAME                              TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
service/argo-rollouts-dashboard   ClusterIP   10.104.113.233   <none>        3100/TCP   4m40s

NAME                                      READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/argo-rollouts             2/2     2            2           4m40s
deployment.apps/argo-rollouts-dashboard   1/1     1            1           4m40s

NAME                                                 DESIRED   CURRENT   READY   AGE
replicaset.apps/argo-rollouts-555667ffc9             2         2         2       4m40s
replicaset.apps/argo-rollouts-dashboard-5878c84fb4   1         1         1       4m40s

Step 1.3. using Helm with Argo CD Operator (option)

Argo CD가 이미 설치되어 있다면 Operator를 사용하여 설치할 수 있습니다.

spec.source.helm.parametersspec.source.helm.values는 환경에 맞게 수정하여 사용하시기 바랍니다.

$ cat <<EOF | kubectl apply -f -
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: argo-rollouts
  namespace: argocd
spec:
  destination:
    name: in-cluster
    namespace: argo-rollouts
  project: default
  source:
    chart: argo-rollouts
    helm:
      parameters:
      - name: dashboard.enabled
        value: "true"
      - name: dashboard.ingress.enabled
        value: "true"
      - name: dashboard.ingress.ingressClassName
        value: nginx
      values: |-
        dashboard:
          ingress:
            annotations:
              nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
              cert-manager.io/cluster-issuer: letsencrypt-prod
            hosts:
              - argorollouts.awx.kr
            tls:
              - secretName: argorollouts-awx-kr-cert
                hosts:
                  - argorollouts.awx.kr
    repoURL: https://argoproj.github.io/argo-helm
    targetRevision: 2.14.0
  syncPolicy:
    syncOptions:
    - CreateNamespace=true
EOF
application.argoproj.io/argo-rollouts created
$ kubectl get applications/argo-rollouts  -n argocd
NAME            SYNC STATUS   HEALTH STATUS   REVISION
argo-rollouts   Synced        Healthy         2.14.0

Argo CD의 UI에서 배포된 리소들을 확인하면 다음과 같습니다.

using_helm_with_argocd_operator.png

Step 2. Kubectl Plugin Installation (option)

kubectl plugin은 선택 사항으로 설치를 해두시면 Argo Rollouts 관리가 용이하며, 시각화를 제공하고 있어 사용 배포 전략에 따른 사용이 편리합니다.

Step 2.1. Brew

Homebrew 패키지 관리자를 사용하여 설치 제공

$ brew install argoproj/tap/kubectl-argo-rollouts

Step 2.2. Manual

Linux, MacOS, Windows의 다양한 플랫폼에서 사용 가능하며 기본적으로 64bit 만 제공됨

$ curl -LO https://github.com/argoproj/argo-rollouts/releases/latest/download/kubectl-argo-rollouts-linux-amd64
$ chmod 755 ./kubectl-argo-rollouts-linux-amd64
$ sudo mv -fv ./kubectl-argo-rollouts-linux-amd64 /usr/local/bin/kubectl-argo-rollouts
$ kubectl argo rollouts version
kubectl-argo-rollouts: v1.2.0+08cf10e
  BuildDate: 2022-03-22T00:25:11Z
  GitCommit: 08cf10e554fe99c24c8a37ad07fadd9318e4c8a1
  GitTreeState: clean
  GoVersion: go1.17.6
  Compiler: gc
  Platform: linux/amd64

Step 2.3. Connecting UI Dashboard

Argo Rollouts dashboard에 접속 해보겠습니다.

쿠버네티스 클러스터 외부에서 NodePort 또는 LoadBalancer를 통해 접속을 하기위해서는 argo-rollouts-dashboard Deployment resource를 설치해주어야 합니다.

외부에서 접속이 필요하지 않다면 Argo Rollouts CLI를 사용하여 내장된 dashboard 기능을 사용 할 수 있습니다.

$ kubectl argo rollouts dashboard
INFO[0000] Argo Rollouts Dashboard is now available at localhost 3100

$ netstat -nptl | egrep 'Proto|:3100'
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp6       0      0 :::3100                 :::*                    LISTEN      449168/kubectl-argo

이제 브라우저에서 UI Dashboard에 접속합니다. 접속 URL로는 localhost:3100 또는 :3100 를 사용합니다.

argo-rollouts-dashboard_01.png

Argo Rollouts를 사용하여 배포된 애플리케이션이 없어 UI Dashboard에 아무것도 표시되지 않는 것이 정상입니다.

Step 2.4. Shell auto completion

bash, zsh, fish 및 powershell에서 Shell 자동 완성 기능을 제공 하고 있어 CLI 사용시 매우 유용 합니다.

Bash:
  $ source <(kubectl-argo-rollouts completion bash)

  # To load completions for each session, execute once:
  # Linux:
  $ kubectl-argo-rollouts completion bash > /etc/bash_completion.d/kubectl-argo-rollouts
  # macOS:
  $ kubectl-argo-rollouts completion bash > /usr/local/etc/bash_completion.d/kubectl-argo-rollouts

Zsh:
  # If shell completion is not already enabled in your environment,
  # you will need to enable it.  You can execute the following once:

  $ echo "autoload -U compinit; compinit" >> ~/.zshrc

  # To load completions for each session, execute once:
  $ kubectl-argo-rollouts completion zsh > "${fpath[1]}/_kubectl-argo-rollouts"

  # You will need to start a new shell for this setup to take effect.

fish:
  $ kubectl-argo-rollouts completion fish | source

  # To load completions for each session, execute once:
  $ kubectl-argo-rollouts completion fish > ~/.config/fish/completions/kubectl-argo-rollouts.fish

PowerShell:
  PS> kubectl-argo-rollouts completion powershell | Out-String | Invoke-Expression

  # To load completions for every new session, run:
  PS> kubectl-argo-rollouts completion powershell > kubectl-argo-rollouts.ps1
  # and source this file from your PowerShell profile.
$ kubectl argo rollouts completion [bash|zsh|fish|powershell]
or
$ kubectl-argo-rollouts completion [bash|zsh|fish|powershell]

 

Official Website

 

END