티스토리 뷰

Developer

How to install Argocd

rocksea 2022. 4. 25. 03:32

Argocd

ArgoCD is a declarative GitOps tool built to deploy applications to Kubernetes. While the continuous delivery (CD) space is seen by some as crowded these days, ArgoCD does bring some interesting capabilities to the table. Unlike other tools, ArgoCD is lightweight and easy to configure.

ArgoCD란 GitOps툴로 K8S에 Application을 쉽게 배포하기 위한 용도로 사용한다. 여러 GitOps툴에 비해 가볍고 사용법이 쉬워서
K8S에 Container를 손쉽게 배포하기 위해 사용한다.

1. Namespace 생성

$ kubectl create namespace argo

2. Argo Repo 등록

Argocd Server설치를 위해 Repo를 등록한다.

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

 

$ helm repo update

 

4. External Ip 사용을 위한 LoadBalancer 등록

values.yaml파일 수정 후 등록

$ helm fetch argo/argo-cd

$ tar xvfz argo-cd-3.29.5.tgz

$ cd argo-cd

$ vi values.yaml

# server
server:
## Server service configuration <-- 해당 라인을 LoadBalancer로 수정
  service:
    annotations:
    labels: {}
    # type: ClusterIP
    type: LoadBalancer

또는 아래 5번 설치 과정 후 변경

# Argo CD Server를 외부에서 접속할 수 있도록 Service의 type을 LoadBalancer로 변경
$ kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'

 

5. Installing Argocd

$ helm install argo -n argo argo/argo-cd -f values.yaml

NAME: argo
LAST DEPLOYED: Thu Jan 13 14:13:51 2022
NAMESPACE: argo
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
In order to access the server UI you have the following options:

1. kubectl port-forward service/argo-argocd-server -n argo 8080:443

    and then open the browser on  and accept the certificate

2. enable ingress in the values file `server.ingress.enabled` and either
      - Add the annotation for ssl passthrough: <https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/ingress.md#option-1-ssl-passthrough>
      - Add the `--insecure` flag to `server.extraArgs` in the values file and terminate SSL at your ingress: <https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/ingress.md#option-2-multiple-ingress-objects-and-hosts>
$ helm list -n argo
NAME	NAMESPACE	REVISION	UPDATED                             	STATUS  	CHART         	APP VERSION
argo	argo     	1       	2022-01-13 14:13:51.299386 +0900 KST	deployed	argo-cd-3.29.5	v2.2.2

 

6. Service 확인

$ kubectl get svc argo-argocd-server -nargo
NAME                 TYPE           CLUSTER-IP     EXTERNAL-IP                                                                    PORT(S)                      AGE
argo-argocd-server   LoadBalancer   10.100.52.98   xxxxxx-xxxxxx.ap-northeast-2.elb.amazonaws.com   80:32717/TCP,443:31979/TCP   7m29s

 

7. Login Argocd

$ kubectl -n argo get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d && echo
DrCVBiczdD8g1v0g
$ kubectl -n argo get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d && echo
DrCVBiczdD8g1v0g

 

로그인창을 통해 admin계정의 추출한 비밀번호를 입력한다.

 

또는 CLI를 통해 Login 후 App을 생성 할 수 있다.

$ argocd app create member-api \
--repo https://github.com/rocksea/sample-app.git \
--path helmchart/member-api \
--dest-namespace dev \
--dest-server https://kubernetes.default.svc \

 

댓글