...
Gitea(Git 호스팅 서비스), Harbor(도커 레지스트리), 그리고 ArgoCD(쿠버네티스 애플리케이션 배포 도구)를 사용하여 자동화된 애플리케이션 배포 방법을 소개합니다.
1. Gitea
Gitea Helm Charts 다운로드 및 설치(Minimal)
...
코드 블럭 |
---|
[root@m-k8s gitea]# cd ~ [root@m-k8s ~]# yum -y install git # git 인증서 검증 비활성화 [root@m-k8s ~]# git config --global http.sslVerify false # git 유저 정보 설정 [root@m-k8s ~]# git config --global user.name "gitea-admin" [root@m-k8s ~]# git config --global user.email "gitea@local.domain" [root@m-k8s ~]# git clone http://192.168.1.201:3000/gitea_admin/my_application.git Cloning into 'my_application'... warning: You appear to have cloned an empty repository [root@m-k8s ~]# cd my_application [root@m-k8s my_application]# vi mynginx.yaml apiVersion: apps/v1 kind: Deployment metadata: name: mynginx-deployment labels: app: mynginx spec: replicas: 3 selector: matchLabels: app: mynginx template: metadata: labels: app: mynginx spec: containers: - name: mynginx image: 192.168.1.202/library/myimage:latest ## 다음번 lb ip 예측 (gitea ip +1) ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: mynginx-service spec: selector: app: mynginx ports: - protocol: TCP port: 80 targetPort: 80 type: LoadBalancer [root@m-k8s my_application]# git add . [root@m-k8s my_application]# git status [root@m-k8s my_application]# git commit -m "myngnix manifest upload" [master (root-commit) e7be4fc] myngnix manifest upload 1 file changed, 34 insertions(+) [root@m-k8s my_application]# git push origin master Username for 'http://192.168.1.201:3000': gitea_admin Password for 'http://gitea_admin@192.168.1.201:3000': Counting objects: 3, done. Delta compression using up to 2 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 454 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: . Processing 1 references remote: Processed 1 references in total To http://192.168.1.201:3000/gitea_admin/my_application.git * [new branch] master -> master |
웹에서 업로드 확인
...
2. Harbor
Harbor Helm Charts 다운로드 및 설치
...
코드 블럭 |
---|
[root@m-k8s ~]# kubectl run test --image=192.168.1.155/library/myimage:latest [root@m-k8s ~]# kubectl get pod [root@m-k8s ~]# kubectl describe pod test Image: 192.168.1.202/library/myimage:latest Normal Pulling 102s kubelet Pulling image "192.168.1.202/library/myimage:latest" Normal Pulled 101s kubelet Successfully pulled image "192.168.1.202/library/myimage:latest" in 155ms (155ms including waiting) |
3. ArgoCD
ArgoCD Helm Charts 다운로드 및 설치
...