Kubernetes – ArgoCD 를 이용해 서비스 배포하기

By | 2022년 12월 10일
Table of Contents

Kubernetes – ArgoCD 를 이용해 서비스 배포하기

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

github repo 생성하기

private github repo 를 생성해 줍니다.

https://github.com/skyer9/kuberepo

디렉토리 구성은 아래처럼 합니다.

argocd-resources
└── resources
    └── app
        └── demo
            ├── deployment.yaml
            └── service.yaml
vi deployment.yaml
---------------------------
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx-test
spec:
  selector:
    matchLabels:
      run: my-nginx-test
  replicas: 1
  template:
    metadata:
      labels:
        run: my-nginx-test
    spec:
      containers:
      - name: my-nginx-test
        image: nginx
        ports:
        - containerPort: 80
---------------------------
vi service.yaml
---------------------------
apiVersion: v1
kind: Service
metadata:
  name: my-nginx-test
  labels:
    run: my-nginx-test
spec:
  type: NodePort
  ports:
  - nodePort: 32080
    port: 80
    protocol: TCP
  selector:
    run: my-nginx-test
---------------------------

repo 등록

Settings > Repositories 에 위에서 생성한 repo 를 등록합니다.

PAT 를 이용해 인증하는 것이 편합니다.,

Application 생성

sync 를 눌러주면 동기화됩니다.

kubectl get svc
NAME            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
kubernetes      ClusterIP   10.96.0.1       <none>        443/TCP          7d1h
my-nginx-test   NodePort    10.96.132.171   <none>        80:32080/TCP     5m19s

curl http://10.96.132.171/

One thought on “Kubernetes – ArgoCD 를 이용해 서비스 배포하기

답글 남기기