본문 바로가기

프로그래밍/Samsung Cloud Platform

Samsung Cloud Platform(SCP) Tutorial 4 - ArgoCD

서론

기존에 SCP에서 제공하는 Devops Console을 사용하려고 하였으나, 멀티클라우드 관점에서 운영을 할 때 동일한 환경에서 했으면 좋겠다는 클라우드 팀의 의견에 따라 ArgoCD로 배포하기로 수정하였다.

 

ArgoCD 생성

Ubuntu Linux 환경에서 진행할 것이고 타 OS의 경우 아래의 ArgoCD 문서를 확인해야한다.

https://argo-cd.readthedocs.io/en/stable/getting_started/

 

Getting Started - Argo CD - Declarative GitOps CD for Kubernetes

Getting Started Tip This guide assumes you have a grounding in the tools that Argo CD is based on. Please read understanding the basics to learn about these tools. Requirements Installed kubectl command-line tool. Have a kubeconfig file (default location i

argo-cd.readthedocs.io

 

 

클러스터에 argocd 라는 namespace를 만든 뒤 argocd를 설치한다.

kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/core-install.yaml

그 후, argo cli를 설치한다.

curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd
rm argocd-linux-amd64

설치가 완료되면 argocd-server의 서비스를 ClusterIP에서 LoadBalancer로 타입을 변경해준다.

굳이 로드밸런서로 하지 않아도 되지만, argocd UI를 사용하기 위해 외부에서 접근할 것이므로 LB로 변경한다.

kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'

※ argocd-server의 외부 IP가 pending에서 외부 ip로 변경될 때까지 기다린 뒤 다음 작업을 진행한다.

만약 pending에서 변하지 않는 경우 Load Balancer를 생성했는지 확인한다.

 

 

Argo cli의 초기 비밀번호를 확인한다.

argocd admin initial-password -n argocd

 

그 후, argocd-server의 IP를 확인한 뒤 로그인한다.

argocd login <ARGOCD_SERVER>

 

argocd의 비밀번호를 변경한다.

argocd account update-password

 

그 후, arogocd-server의 외부 IP주소를 입력하면 하단과 같이 argocd UI가 나온다.

 

ArgoCD 사용

ArgoCD는 Helm Chart 기반으로 배포할 수 있는데, 과거에 만든 gitlab에 Helm Chart 폴더 구조로 저장하고 ArgoCD에 연결하면 배포가 가능하다.

현재 gitlab의 helm chart와 ArgoCD 내부 UI는 보안 상 공개할 수 없어 따로 검색을 해야한다.