마구잡

Kubernetes + gitlab + gitlab-ci + harbor + argocd 총 집합 ( 2 ) 본문

Kubernetes

Kubernetes + gitlab + gitlab-ci + harbor + argocd 총 집합 ( 2 )

MAGUJOB 2024. 5. 15. 22:53
반응형

 

지난번 깃랩 설치에 이어서

 

Kubernetes + gitlab + gitlab-ci + harbor + argocd 총 집합 ( 1 )

이전 마지막 글을 쓴 시점 부터 지금까지 약 2개월간 혼자서 실제 사이트의 운영환경과 거의 비슷한 구성을 만들기 위해무수한 삽질 및 고생을하다 드디어 어느정도 윤곽이 잡혀 글을쓰게 되었

mgujob.tistory.com


 

하버 설치 전 쿠버네티스 클러스터에서 사용 할 스토리지가 배포 되어있어야 한다.

 

하버 설치 전 MetalLB가 배포 되어있어야 한다.


 

1. 하버 설치

 

헬름을 통한 하버 차트 pull

helm repo add harbor https://helm.goharbor.io
helm pull harbor/harbor

 

압축 해제 & 밸류 파일 복사

tar -zxvf harbor-1.14.1.tgz && cd harbor-1.14.1
# 현재 최신 버전
cp values.yaml my-values.yaml

 

my-values.yaml 수정

 20     auto:
 21       # The common name used to generate the certificate, it's necessary
 22       # when the type isn't "ingress"
 23       commonName: "사용할.도메인.com" 
          # 추후 해당 도메인을 사용하여 자동으로 TLS/SSL 인증서를 생성한다.
 24     secret:
 25       # The name of secret which contains keys named:
 26       # "tls.crt" - the certificate
 27       # "tls.key" - the private key
 28       secretName: ""
 29   ingress:
 30     hosts:
 31       core: core.harbor.domain
 
...

 66   nodePort:
 67     # The name of NodePort service
 68     name: harbor
 69     ports:
 70       http:
 71         # The service port Harbor listens on when serving HTTP
 72         port: 80
 73         # The node port Harbor listens on when serving HTTP
 74         nodePort: 30002
 75       https:
 76         # The service port Harbor listens on when serving HTTPS
 77         port: 443
 78         # The node port Harbor listens on when serving HTTPS
 79         nodePort: 30003
 80   loadBalancer:
 81     # The name of LoadBalancer service
 82     name: harbor
 83     # Set the IP if the LoadBalancer supports assigning IP
 84     IP: "192.168.60.118" 
        # 로드밸런서로 사용할 아이피 설정
 85     ports:
 86       # The service port Harbor listens on when serving HTTP
 87       httpPort: 80
 88       # The service port Harbor listens on when serving HTTPS

...

106 externalURL: https://사용할 도메인.com # 외부에서 접속할 URL 지정
107
108 # The internal TLS used for harbor components secure communicating. In order to enable https

...

192       # Set it to "-" to disable dynamic provisioning
193       storageClass: "" # 사용할 스토리지 클래스 선언

...

346 existingSecretAdminPasswordKey: HARBOR_ADMIN_PASSWORD
347 harborAdminPassword: "Harbor12345" # 하버 기본 패스워드 설정

 

네임스페이스 생성

kubectl create ns harbor

 

헬름을 통한 하버 배포

helm install harbor -f my-values.yaml . -n harbor

 

배포 확인

kubectl get po -n harbor
NAME                                 READY   STATUS    RESTARTS        AGE
harbor-core-6f5c677665-7fnxt         1/1     Running   1 (2d13h ago)   41d
harbor-database-0                    1/1     Running   1 (2d13h ago)   41d
harbor-jobservice-6485d99fc6-wc8n2   1/1     Running   6 (2d13h ago)   41d
harbor-nginx-7dff97bfc-d9qjn         1/1     Running   1 (2d13h ago)   41d
harbor-portal-58fb59b8d-ct2pv        1/1     Running   1 (2d13h ago)   41d
harbor-redis-0                       1/1     Running   1 (2d13h ago)   41d
harbor-registry-5655474c97-j98vp     2/2     Running   2 (2d13h ago)   41d
harbor-trivy-0                       1/1     Running   1 (2d13h ago)   41d

kubectl get svc -n harbor
NAME                TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)                      AGE
harbor              LoadBalancer   10.100.207.178   192.168.60.118   80:31688/TCP,443:32645/TCP   41d
harbor-core         ClusterIP      10.100.94.211    <none>           80/TCP                       41d
harbor-database     ClusterIP      10.100.242.149   <none>           5432/TCP                     41d
harbor-jobservice   ClusterIP      10.106.195.220   <none>           80/TCP                       41d
harbor-portal       ClusterIP      10.106.4.33      <none>           80/TCP                       41d
harbor-redis        ClusterIP      10.98.236.108    <none>           6379/TCP                     41d
harbor-registry     ClusterIP      10.96.130.205    <none>           5000/TCP,8080/TCP            41d
harbor-trivy        ClusterIP      10.101.249.234   <none>           8080/TCP                     41d

 

하버 웹 접속

하버 대시보드


옵션

추후 부가적으로 CI/CD 사용을 하기 위해선 my-values.yaml 에 설정한 도메인을 DNS혹은 로컬 hosts파일에 등록하길 바란다.

반응형