https://argo-cd.readthedocs.io/en/stable/getting_started/
1. Argo CD 설치하기
namespace 생성하기
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
2. Argo CD CLI 설치
Argo CD CLI 참고 사이트 : https://argo-cd.readthedocs.io/en/stable/cli_installation/
Argo CD의 version 확인
VERSION=$(curl --silent "https://api.github.com/repos/argoproj/argo-cd/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
/* 확인한 버전으로 다운 받기 */
curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/$VERSION/argocd-linux-amd64
/* 실행권한 부여 */
chmod +x /usr/local/bin/argocd
3. Argo CD API Server 외부 접속 허용
/* NodePort로 셋팅 */
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort"}}'
/* LoadBalancer 는 클라우드 업체만 사용가능 */
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
4. port forwarding은 service 노출없이 API Server에 연결가능
kubectl port-forward svc/argocd-server -n argocd 8080:443
5. CLI를 사용하여 로그인
- 계정(admin) 의 초기 비밀번호는 Argo CD 설치 네임스페이스에 password이름이 지정된 비밀 필드에 텍스트로 저장됩니다.
아래 CLI 를 사용하여 비빌번호 검색
argocd admin initial-password -n argocd
root@master:~# argocd admin initial-password -n argocd
kDGz7zQxNGRmD2A0
/* argocd 접속 서버 확인 */
root@master:~# kubectl get service -n argocd
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
argocd-applicationset-controller ClusterIP 10.110.173.77 <none> 7000/TCP,8080/TCP 148m
argocd-dex-server ClusterIP 10.111.104.44 <none> 5556/TCP,5557/TCP,5558/TCP 148m
argocd-metrics ClusterIP 10.96.114.35 <none> 8082/TCP 148m
argocd-notifications-controller-metrics ClusterIP 10.99.241.186 <none> 9001/TCP 148m
argocd-redis ClusterIP 10.96.165.2 <none> 6379/TCP 148m
argocd-repo-server ClusterIP 10.98.141.163 <none> 8081/TCP,8084/TCP 148m
argocd-server NodePort 10.111.108.21 <none> 80:30316/TCP,443:31865/TCP 148m
argocd-server-metrics ClusterIP 10.97.122.15 <none> 8083/TCP 148m
argocd-server 에서 NodePort확인 노드 포트가 30316,32865 노드 포트로 접속
접속 아이피는 마스터아이피 또는 node아이피로 접속
root@master:~# kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
master Ready control-plane 3d6h v1.29.0 10.0.100.2 <none> Ubuntu 22.04.3 LTS 5.15.0-91-generic containerd://1.7.2
node1 Ready <none> 3d5h v1.29.0 10.0.100.3 <none> Ubuntu 22.04.3 LTS 5.15.0-91-generic containerd://1.7.2
node2 Ready <none> 3d4h v1.29.0 10.0.100.4 <none> Ubuntu 22.04.3 LTS 5.15.0-91-generic containerd://1.7.2
node3 Ready <none> 3d4h v1.29.0 10.0.100.5 <none> Ubuntu 22.04.3 LTS 5.15.0-91-generic containerd://1.7.2
/* 비밀번호 확인후 로그인 */
root@master:~# argocd login --insecure 10.0.100.2:30316
Username: admin
Password:
'admin:login' logged in successfully
Context '10.0.100.2:30316' updated
/* 비밀번호변경 */
argocd account update-password
/* curl 접속 확인 테스트 */
root@master:~# curl -k https://10.0.100.2:30316
<!doctype html><html lang="en"><head><meta charset="UTF-8"><title>Argo CD</title><base href="/"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" type="image/png" href="assets/favicon/favicon-32x32.png" sizes="32x32"/><link rel="icon" type="image/png" href="assets/favicon/favicon-16x16.png" sizes="16x16"/><link href="assets/fonts.css" rel="stylesheet"><script defer="defer" src="main.f14bff1ed334a13aa8c2.js"></script></head><body><noscript><p>Your browser does not support JavaScript. Please enable JavaScript to view the site. Alternatively, Argo CD can be used with the <a href="https://argoproj.github.io/argo-cd/cli_installation/">Argo CD CLI</a>.</p></noscript><div id="app"></div></body><script defer="defer" src="extensions.js"></script></html>root@master:~#
/* vm에서 포트 포워딩 후 브라우저에서 접속확인 */
https://192.168.2.50:30316/
6. Argo CD에서 제공해주는 테스트 앱 생성
방명록 애플리케이션이 포함된 예제 저장소는
https://github.com/argoproj/argocd-example-apps
7. Git 리포지토리에서 애플리케이션 생성
- NEW APP 버튼 클릭
8. 애플리케이션 동기화(배포)
CLI를 통해 동기화
root@master:~# argocd app get guestbook
Name: argocd/guestbook
Project: default
Server: https://kubernetes.default.svc
Namespace: default
URL: https://10.0.100.2:30316/applications/guestbook
Repo: https://github.com/argoproj/argocd-example-apps.git
Target: HEAD
Path: guestbook
SyncWindow: Sync Allowed
Sync Policy: <none>
Sync Status: OutOfSync from HEAD (d7927a2)
Health Status: Missing
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
Service default guestbook-ui OutOfSync Missing
apps Deployment default guestbook-ui OutOfSync Missing
root@master:~# argocd app sync guestbook
TIMESTAMP GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
2024-01-09T13:39:45+09:00 Service default guestbook-ui OutOfSync Missing
2024-01-09T13:39:45+09:00 apps Deployment default guestbook-ui OutOfSync Missing
2024-01-09T13:39:46+09:00 Service default guestbook-ui Synced Healthy
2024-01-09T13:39:46+09:00 Service default guestbook-ui Synced Healthy service/guestbook-ui created
2024-01-09T13:39:46+09:00 apps Deployment default guestbook-ui OutOfSync Missing deployment.apps/guestbook-ui created
2024-01-09T13:39:46+09:00 apps Deployment default guestbook-ui Synced Progressing deployment.apps/guestbook-ui created
Name: argocd/guestbook
Project: default
Server: https://kubernetes.default.svc
Namespace: default
URL: https://10.0.100.2:30316/applications/guestbook
Repo: https://github.com/argoproj/argocd-example-apps.git
Target: HEAD
Path: guestbook
SyncWindow: Sync Allowed
Sync Policy: <none>
Sync Status: Synced to HEAD (d7927a2)
Health Status: Progressing
Operation: Sync
Sync Revision: d7927a27b4533926b7d86b5f249cd9ebe7625e90
Phase: Succeeded
Start: 2024-01-09 13:39:45 +0900 KST
Finished: 2024-01-09 13:39:46 +0900 KST
Duration: 1s
Message: successfully synced (all tasks run)
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
Service default guestbook-ui Synced Healthy service/guestbook-ui created
apps Deployment default guestbook-ui Synced Progressing deployment.apps/guestbook-ui created
UI를 통해 동기화
'시스템 > 쿠버네티스' 카테고리의 다른 글
[쿠버네티스] 우분투22.04 도커 설치하기 (0) | 2024.01.09 |
---|---|
[쿠버네티스] 헬름 설치 (0) | 2024.01.09 |
[쿠버네티스] 젠킨스 CI 구성 (0) | 2024.01.09 |
[쿠버네티스] k8s 젠킨스 설치 (0) | 2024.01.09 |
쿠버네티스 대시보드 설치 (0) | 2024.01.08 |
댓글