yeonghoon.kim

  • 게시판
  • 갤러리

ArgoCD와 GitOps 구조 준비

김영훈 2026.06.16 12:20 조회 수 : 16

Git에 배포 파일을 올려두고도 계속 직접 반영하는 게 귀찮아짐.

처음에는 manifest를 직접 적용했음.

# Kubernetes manifest를 직접 적용한다.
kubectl apply -f k8s/

Helm으로 묶은 뒤에도 결국 배포 명령은 직접 실행해야 했음.

# Helm Chart를 직접 배포한다.
helm upgrade --install rhymix ./helm/rhymix \
  -n 3009-yeonghoon-kim \
  --set namespace.create=false

그래서 Git에 적힌 상태를 기준으로 Kubernetes 상태를 맞추는 구조를 잡기 시작함.

구축 매뉴얼 기준으로는 ArgoCD를 설치하고 GitOps 배포 구조의 입구를 준비하는 단계.

Git 저장소
= 원하는 상태

Kubernetes 클러스터
= 실제 상태

ArgoCD
= Git의 원하는 상태와 클러스터의 실제 상태를 비교하고 맞추는 도구

ArgoCD namespace 생성 및 설치.

ArgoCD install manifest는 CRD annotation 크기 문제로 일반 apply가 실패할 수 있어서 server-side apply 사용.

# ArgoCD namespace를 만들고 install manifest를 server-side apply 방식으로 설치한다.
set -e
kubectl create namespace argocd || true
kubectl apply --server-side --force-conflicts -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/v3.4.3/manifests/install.yaml
kubectl -n argocd rollout status deployment/argocd-server --timeout=240s
kubectl -n argocd rollout status deployment/argocd-repo-server --timeout=240s
kubectl -n argocd rollout status deployment/argocd-applicationset-controller --timeout=240s
kubectl -n argocd rollout status statefulset/argocd-application-controller --timeout=240s

ArgoCD 설치 후에는 cluster-apps repo의 bootstrap manifest를 적용함.

# ArgoCD 설정, 알림 ConfigMap, Ingress를 적용한다.
set -e
cd /home/ioniere/gitlab-project-clones/ioniere/cluster-apps
kubectl -n argocd apply -f bootstrap/argocd-cmd-params-cm.yaml
kubectl -n argocd apply -f bootstrap/argocd-notifications-cm.yaml
kubectl -n argocd apply -f bootstrap/argocd-ingress.yaml
kubectl -n argocd rollout restart deployment/argocd-server
kubectl -n argocd rollout status deployment/argocd-server --timeout=180s

여기서 적용하는 파일은 Secret이 아니라 ConfigMap과 Ingress.

argocd-cmd-params-cm.yaml에서는 ArgoCD server를 insecure 모드로 둠.

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-cmd-params-cm
  namespace: argocd
data:
  server.insecure: "true"

외부에 HTTP로 그대로 공개한다는 뜻은 아님.

앞단의 ingress-nginx가 HTTPS 입구 역할을 하고, ingress-nginx 뒤쪽에서 argocd-server로 넘길 때 HTTP를 사용하는 구조.

ArgoCD Ingress는 argo.yeonghoon.kim으로 들어온 요청을 argocd-server Service로 보냄.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: argocd-server
  namespace: argocd
spec:
  ingressClassName: nginx
  rules:
    - host: argo.yeonghoon.kim
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: argocd-server
                port:
                  number: 80

접속 흐름.

https://argo.yeonghoon.kim/
-> Ingress VIP 192.168.200.49
-> ingress-nginx
-> argocd-server Service:80
-> argocd-server Pod

Ingress 확인.

# ArgoCD Ingress가 생성됐고 Ingress VIP에 붙었는지 확인한다.
kubectl -n argocd get ingress argocd-server -o wide

Ingress VIP 직접 응답 확인.

# Kubernetes Ingress VIP로 직접 ArgoCD UI HTTP 상태 코드를 확인한다.
curl -k -sS -o /dev/null -w "%{http_code}\n" \
  --max-time 10 \
  --resolve "argo.yeonghoon.kim:443:192.168.200.49" \
  https://argo.yeonghoon.kim/

정상 기준은 HTTP 200.

root Application 구조도 확인함.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: cluster-apps
  namespace: argocd
spec:
  project: default
  source:
    repoURL: ssh://[email protected]:2224/ioniere/cluster-apps.git
    targetRevision: main
    path: .
    directory:
      recurse: true
      include: '{projects/*.yaml,apps/*.yaml,storage/*.yaml,grafana/*.yaml,alerting/*.yaml,monitoring/*.yaml}'
  syncPolicy:
    automated: {}
  destination:
    server: https://kubernetes.default.svc
    namespace: argocd

이 파일은 ArgoCD에게 cluster-apps 저장소를 읽고 그 안의 앱 정의들을 운영 대상으로 삼으라고 알려주는 입구.

다만 이 단계에서 root Application을 바로 적용하지는 않음.

private GitLab repo를 읽으려면 ArgoCD repo credential Secret이 필요하고, Pod 안에서 gitlab.yeonghoon.kim을 올바른 IP로 찾는 DNS/CoreDNS 경로도 필요함.

그래서 이 날은 ArgoCD 설치와 Ingress 확인, GitOps 구조 입구 준비까지로 정리.

Secret 복구와 GitLab 접근 경로를 준비한 뒤 root Application을 적용하는 순서로 잡음.


  • 추천 0

  • 비추천 0
이 게시물을
목록

댓글 0

번호 제목 글쓴이 날짜 조회 수
19 DGX Kubernetes 구성 계획 김영훈 2026.06.08 25
18 Kubernetes 기본 클러스터, ingress-nginx 설치 김영훈 2026.06.09 15
17 Docker Compose 서비스를 Kubernetes로 이전(깃랩 도커 저장소 필요) [2] 김영훈 2026.06.10 20
16 yeonghoon.kim 배포 파일을 Helm Chart로 전환 [1] 김영훈 2026.06.12 18
15 SOPS age로 Kubernetes Secret 암복호화 김영훈 2026.06.15 23
» ArgoCD와 GitOps 구조 준비 김영훈 2026.06.16 16
13 CoreDNS로 GitLab Registry 내부 주소 고정 김영훈 2026.06.17 19
12 복구 런북 초반 누락 사항 정리 김영훈 2026.06.17 15
11 SOPS Secret 복구와 ArgoCD root Application 적용 김영훈 2026.06.18 28
10 관측 스택과 앱 배포 저장소 구조 정리 김영훈 2026.06.19 23
9 ArgoCD 복구 중 GitLab 접근 문제 정리 김영훈 2026.06.22 26
8 ImagePullBackOff와 registry pull secret 누락 김영훈 2026.06.22 17
7 worker 재부팅 전 drain 절차 정리 김영훈 2026.06.26 20
6 control-plane 장애 시나리오 관찰 김영훈 2026.06.27 12
5 OutOfSync와 Degraded 구분하기 김영훈 2026.06.28 25
4 Git revert는 기록을 지우는 게 아니라 되돌리는 기록을 남기는 것 김영훈 2026.06.29 19
3 Stateful과 Stateless 구분해보기 김영훈 2026.07.02 23
2 GitLab Registry PAT 만료로 이미지 Pull 실패 김영훈 2026.07.08 14
1 yeonghoon.kim php 업그레이드 김영훈 2026.07.09 0
쓰기 태그
 첫 페이지 8 9 10 11 12 13 14 15 16 17 끝 페이지