kind와 argoCD활용

최지영·2025년 1월 5일
0

K8S

목록 보기
3/3

📜 Kubernetes 클러스터 구축 (Kind 이용)


  • Kind 설치
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
  • kubectl 설치
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
  • Kind 클러스터 설정
    포트 30007 ~ 30012는 외부에서 접근했을때 사용할 목적으로 여러 포트를 열어둠
# kind-config.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraPortMappings:
  - containerPort: 30007   # Kind 내부 NodePort
    hostPort: 30007        # 로컬에서 접근할 포트
    protocol: TCP
  - containerPort: 30008
    hostPort: 30008
    protocol: TCP
  - containerPort: 30009
    hostPort: 30009
    protocol: TCP
  - containerPort: 30010
    hostPort: 30010
    protocol: TCP
  - containerPort: 30011
    hostPort: 30011
    protocol: TCP
  - containerPort: 30012
    hostPort: 30012
    protocol: TCP
  • Kind 클러스터 생성
kind create cluster --name argo-cd --config kind-config.yaml
  • Argo Workflows 설치
curl -sLO https://github.com/argoproj/argo-workflows/releases/latest/download/argo-linux-amd64
chmod +x argo-linux-amd64
sudo mv argo-linux-amd64 /usr/local/bin/argo

kubectl create namespace argo
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
  • Argo Server 포트포워딩
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort", "ports": [{"port": 80, "targetPort": 8080, "nodePort": 30008, "protocol": "TCP", "name": "http"}]}}'

서비스를 실행해주고 나고 서비스를 확인하면 아래와 같이 30008번 포트로 받아주는것을 확인할 수있음

$kubectl get svc -n argocd
NAME                                      TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
argocd-applicationset-controller          ClusterIP   10.96.99.50     <none>        7000/TCP,8080/TCP            2m11s
argocd-dex-server                         ClusterIP   10.96.111.58    <none>        5556/TCP,5557/TCP,5558/TCP   2m11s
argocd-metrics                            ClusterIP   10.96.139.114   <none>        8082/TCP                     2m11s
argocd-notifications-controller-metrics   ClusterIP   10.96.39.17     <none>        9001/TCP                     2m11s
argocd-redis                              ClusterIP   10.96.242.249   <none>        6379/TCP                     2m11s
argocd-repo-server                        ClusterIP   10.96.17.237    <none>        8081/TCP,8084/TCP            2m11s
argocd-server                             NodePort    10.96.101.53    <none>        80:30008/TCP,443:30727/TCP   2m10s
argocd-server-metrics                     ClusterIP   10.96.139.26    <none>        8083/TCP                     2m10s

로그인 하기 위해선 패스워드르 알아야하는데 아래 커맨드로 secret에 저장되있는 패스워드를 가져와서 사용

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

기본아이디는 admin으로 사용된다

🔎 이미지 문제가 있는경우

  • 이미지 문제가 있는 경우 kubectl describe 출력에 "ImagePullBackOff" 메시지가 나타남
kubectl delete pod <POD_NAME> -n argo
kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/latest/download/install.yaml

0개의 댓글