Trydit
S
Solutions & Experts
Explore tools & connect with verified partners.
R
Solution Reviews
Check honest reviews from real users.
E
Experiences
Vivid stories from field engineers.
CommunityTech BlogEducation +
Write ReviewShare Experience
⭐️ MessengerCommunitySolutionsReviewsExperiencesBlogEducation +
이용약관개인정보처리방침

© 2026 Trydit. All rights reserved.

← Back to List
📚 Modern DevOps Series

Kubernetes 클러스터 구축과 ArgoCD를 활용한 GitOps 파이프라인 완성

DevOps_Master•2025.12.10•devops

💡 Summary

Problem:수동 배포로 인한 휴먼 에러 증가와 배포 이력 관리의 어려움
Solution:Kubernetes & ArgoCD
Result:Git을 단일 진실 공급원(SSOT)으로 하는 자동화된 배포 파이프라인 구축, 배포 안정성 100% 달성

1. 프로젝트 배경 및 환경

스타트업 초기에는 EC2 인스턴스에 직접 배포하는 방식을 사용했으나, 서비스 규모가 커지면서 관리해야 할 인스턴스가 20개를 넘어가기 시작했습니다. 배포 때마다 사람이 수동으로 스크립트를 실행하다 보니 버전 불일치 문제와 휴먼 에러가 빈번하게 발생했습니다. 이에 컨테이너 오케스트레이션의 표준인 Kubernetes를 도입하고, ArgoCD를 활용한 GitOps 체계를 구축하여 배포 프로세스를 자동화하기로 결정했습니다.

실습 환경은 다음과 같습니다:

  • Master Node: 1대 (AWS t3.medium, Ubuntu 22.04)
  • Worker Node: 2대 (AWS t3.medium, Ubuntu 22.04)
  • Kubernetes Version: v1.28.2
  • CNI: Calico
  • GitOps Tool: ArgoCD v2.9.3

2. Kubernetes 클러스터 구축 (Kubeadm)

2.1 사전 요구사항 설정

모든 노드에서 공통적으로 실행해야 할 설정입니다. 스왑 메모리를 비활성화하고 필수 커널 모듈을 로드합니다.

# 스왑 비활성화
sudo swapoff -a
sudo sed -i '/ swap / s/^\(দীর\)$/#\1/g' /etc/fstab

# 커널 모듈 로드
cat <

2.2 컨테이너 런타임 (Containerd) 설치

Docker 대신 가벼운 Containerd를 런타임으로 사용합니다.

sudo apt-get update
sudo apt-get install -y containerd
sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml
# SystemdCgroup = true 로 변경 필요
sudo sed -i 's/SystemdCgroup = false/SystemdCgroup = true/g' /etc/containerd/config.toml
sudo systemctl restart containerd

2.3 Kubeadm, Kubelet, Kubectl 설치

sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl

2.4 마스터 노드 초기화 및 CNI 설치

마스터 노드에서 초기화를 진행합니다.

sudo kubeadm init --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address={Master_Node_IP}

초기화가 완료되면 출력되는 kubeadm join ... 명령어를 복사해둡니다. 이후 Pod 통신을 위해 Calico CNI를 설치합니다.

kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/tigera-operator.yaml
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/custom-resources.yaml

3. ArgoCD를 활용한 GitOps 파이프라인 구축

3.1 ArgoCD 설치

별도의 네임스페이스를 생성하고 ArgoCD를 배포합니다.

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

3.2 외부 접속 설정 (LoadBalancer/NodePort)

기본적으로 ArgoCD 서버는 ClusterIP로 설정되어 있습니다. 테스트를 위해 NodePort로 변경하거나 LoadBalancer를 연결합니다.

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

초기 admin 비밀번호는 다음 명령어로 확인합니다.

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

3.3 GitHub 리포지토리 연동

ArgoCD UI에 접속하여 Settings > Repositories에서 애플리케이션 매니페스트(YAML)가 저장된 Git 리포지토리를 등록합니다. Private 리포지토리인 경우 PAT(Personal Access Token) 또는 SSH Key를 등록해야 합니다.

3.4 Application 생성 및 배포

ArgoCD에서 새로운 App을 생성합니다.

  • Application Name: my-backend-service
  • Project: default
  • Sync Policy: Automatic (Prune: true, Self Heal: true)
  • Repository URL: https://github.com/my-org/k8s-manifests.git
  • Path: ./backend/overlays/production
  • Cluster URL: https://kubernetes.default.svc
  • Namespace: production

생성 버튼을 누르면 ArgoCD가 Git 리포지토리의 내용을 읽어와 현재 클러스터 상태와 비교(Diff)하고, Sync를 수행하여 리소스를 생성합니다.

4. 결과 및 성과

이 프로젝트를 통해 얻은 주요 성과는 다음과 같습니다.

  • 배포 안정성 향상: Git을 통해 모든 변경 사항이 관리되므로, 누가 언제 무엇을 변경했는지 추적 가능하며 문제 발생 시 git revert만으로 즉시 롤백이 가능해졌습니다.
  • 운영 효율성 증대: 개발자가 직접 배포를 요청할 필요 없이, MR(Merge Request) 승인만으로 배포가 자동으로 이루어져 Ops 팀의 업무 부하가 줄어들었습니다.
  • Configuration Drift 방지: ArgoCD의 Self-healing 기능 덕분에 누군가 수동으로 클러스터 설정을 변경하더라도 자동으로 Git 상태로 복구되어 설정 불일치 문제를 해결했습니다.

Was this helpful?

🛠️

Introduction to Kubernetes & ArgoCD

Interested in the tool mentioned in this experience? Check out official pricing, verified sales partners, and expert engineers who can help you adopt it.

View Solution InfoFind Experts