마구잡

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

Kubernetes

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

MAGUJOB 2024. 5. 2. 13:53
반응형

이전 마지막 글을 쓴 시점 부터 지금까지 약 2개월간 혼자서 실제 사이트의 운영환경과 거의 비슷한 구성을 만들기 위해

무수한 삽질 및 고생을하다 드디어 어느정도 윤곽이 잡혀 글을쓰게 되었다.


구성 컴포넌트 선택 조건

1. 오픈소스

2. 프라이빗 환경에서 구동

3. 다양한 래퍼런스를 가진 툴

4. 최대한 파드 형태로 배포시킬 수 있을 것

 

클러스터 구성은 편한 방법을 이용하여 진행 . 저는 바이너리 설치로 진행했습니다. https://mgujob.tistory.com/11

 

Kubernetes Binary 설치 - 1

개요 Kubespray, minikube, EKS등 여러 Kubernetes Cluster를 설치하는 Tool 및 서비스가 존재한다. 이번 글에선 좀 귀찮더라도 Binary 설치를 진행한다. (사실 나는 Binary 설치를 더 많이 진행한터라 이 방법에

mgujob.tistory.com


1. 깃랩 설치

헬름을 통한 깃랩 차트 Pull

helm repo add gitlab https://charts.gitlab.io
helm pull gitlab/gitlab

 

압축 해제 & 밸류 파일 복사

tar -zxvf gitlab-7.10.1.tgz && cd gitlab-7.10.1/
# 현재 최신 버전
cp values.yaml my-values.yaml

 

my-values.yaml 수정

# 깃랩 러너와 프로메테우스는 설치 하지 않는다.
# 깃랩 러너는 추후 레거시한 형태로 구성한다.

  50   ## https://docs.gitlab.com/charts/installation/deployment#deploy-the-community-edition
  51   edition: ce # 커뮤니티 에디션
  52
  53   ## https://docs.gitlab.com/charts/charts/globals#gitlab-version
  54   gitlabVersion: "16.10.1"
  55
  56   ## https://docs.gitlab.com/charts/charts/globals#application-resource
  57   application:
  58     create: false
  59     links: []
  60     allowClusterRoles: true
  61   ## https://docs.gitlab.com/charts/charts/globals#configure-host-settings
  62   hosts:
  63     domain: 사용할도메인.git.com
  64     hostSuffix:
  65     https: true
  66     externalIP:
  67     ssh: ~
  68     gitlab: {}
  69     minio: {}
  70     registry: {}
  71     tls: {}
  72     smartcard: {}
  73     kas: {}
  74     pages: {}
...
 879
 880 ## Settings to for the Let's Encrypt ACME Issuer
 881 certmanager-issuer:
 882 #   # The email address to register certificates requested from Let's Encrypt.
 883 #   # Required if using Let's Encrypt.
 884   email: 임의이메일@gmail.com

 

gitlab 네임스페이스 생성

kubectl create ns gitlab

 

gitlab 배포 

# 사전에 필수적으로 default storage class가 설정 되어있어야 한다.
helm install gitlab -f my-values.yaml -n gitlab .

 

gitlab 파드 확인

NAME                                               READY   STATUS      RESTARTS   AGE
gitlab-certmanager-b8fcb485c-5tl2h                 1/1     Running     0          27d
gitlab-certmanager-cainjector-7879688fc5-55ktz     1/1     Running     0          27d
gitlab-certmanager-webhook-749b8f99d5-csj84        1/1     Running     0          27d
gitlab-gitaly-0                                    1/1     Running     0          27d
gitlab-gitlab-exporter-7d4f557c-xd42h              1/1     Running     0          27d
gitlab-gitlab-shell-5dbbb5d5d-dkk2b                1/1     Running     0          27d
gitlab-gitlab-shell-5dbbb5d5d-rl96b                1/1     Running     0          27d
gitlab-issuer-4-x5nnb                              0/1     Completed   0          21d
gitlab-kas-5476f474f7-2xt5c                        1/1     Running     0          27d
gitlab-kas-5476f474f7-6wztj                        1/1     Running     0          27d
gitlab-migrations-4-cp75z                          0/1     Completed   0          21d
gitlab-minio-7746db98c6-vzvk6                      1/1     Running     0          27d
gitlab-nginx-ingress-controller-75d86768f9-c9cjt   1/1     Running     0          27d
gitlab-nginx-ingress-controller-75d86768f9-gxb2p   1/1     Running     0          27d
gitlab-postgresql-0                                2/2     Running     0          27d
gitlab-redis-master-0                              2/2     Running     0          27d
gitlab-registry-5f4f65d49c-2kf9m                   1/1     Running     0          27d
gitlab-registry-5f4f65d49c-jm5p6                   1/1     Running     0          27d
gitlab-sidekiq-all-in-1-v2-86656df9bf-jbvrl        1/1     Running     0          30h
gitlab-toolbox-5547876b98-gzg5w                    1/1     Running     0          27d
gitlab-webservice-default-855cbcc685-4jclf         2/2     Running     0          27d
gitlab-webservice-default-855cbcc685-rjrh9         2/2     Running     0          27d

 

gitlab 서비스 인그레스 확인

ubectl get svc
NAME                                      TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)                                   AGE
gitlab-certmanager                        ClusterIP      10.102.197.135   <none>           9402/TCP                                  27d
gitlab-certmanager-webhook                ClusterIP      10.103.84.79     <none>           443/TCP                                   27d
gitlab-gitaly                             ClusterIP      None             <none>           8075/TCP,9236/TCP                         27d
gitlab-gitlab-exporter                    ClusterIP      10.110.29.95     <none>           9168/TCP                                  27d
gitlab-gitlab-shell                       ClusterIP      10.111.42.78     <none>           22/TCP                                    27d
gitlab-kas                                ClusterIP      10.102.51.136    <none>           8150/TCP,8153/TCP,8154/TCP,8151/TCP       27d
gitlab-minio-svc                          ClusterIP      10.103.25.117    <none>           9000/TCP                                  27d
gitlab-nginx-ingress-controller           LoadBalancer   10.98.226.68     192.168.60.116   80:30349/TCP,443:31075/TCP,22:31689/TCP   27d
gitlab-nginx-ingress-controller-metrics   ClusterIP      10.96.190.73     <none>           10254/TCP                                 27d
gitlab-postgresql                         ClusterIP      10.109.26.207    <none>           5432/TCP                                  27d
gitlab-postgresql-hl                      ClusterIP      None             <none>           5432/TCP                                  27d
gitlab-postgresql-metrics                 ClusterIP      10.97.25.205     <none>           9187/TCP                                  27d
gitlab-redis-headless                     ClusterIP      None             <none>           6379/TCP                                  27d
gitlab-redis-master                       ClusterIP      10.96.104.87     <none>           6379/TCP                                  27d
gitlab-redis-metrics                      ClusterIP      10.106.106.244   <none>           9121/TCP                                  27d
gitlab-registry                           ClusterIP      10.105.226.165   <none>           5000/TCP                                  27d
gitlab-webservice-default                 ClusterIP      10.101.56.86     <none>           8080/TCP,8181/TCP,8083/TCP                27d

kubectl get ing
NAME                        CLASS          HOSTS                   ADDRESS          PORTS     AGE
gitlab-kas                  gitlab-nginx   kas.도메인.git.com        192.168.60.116   80, 443   27d
gitlab-minio                gitlab-nginx   minio.도메인.git.com      192.168.60.116   80, 443   27d
gitlab-registry             gitlab-nginx   registry.도메인.git.com   192.168.60.116   80, 443   27d
gitlab-webservice-default   gitlab-nginx   gitlab.도메인.git.com     192.168.60.116   80, 443   27d

 

gitlab 도메인을 개인 PC의 hosts파일에 등록하거나 dns의 등록 후 웹페이지 접속 ( 해당 과정을 건너뛰고 노드포트로 접속은 가능 )

# 기본 루트 패스워드 확인
kubectl get secrets -n gitlab gitlab-gitlab-initial-root-password --template={{.data.password}} | base64 -d

 

웹 접속


깃랩 접속 화면


아래는 사용중인 git 예시


실제 사용중인 내부 깃랩


다음은 하버 설치 및 이미지 푸시

반응형