EKS에 Helm으로 GitLab 설치하기

brillog·2024년 1월 17일
0

DevOps

목록 보기
1/7

Prerequisites

GitLab 설치

네임스페이스 생성 및 current 네임스페이스 변경

$ kubectl create ns gitlab

$ kubectl config set-context --current --namespace=gitlab

gilab helm repository 추가

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

$ helm repo list

$ helm repo update gitlab

values.yaml 파일 다운로드를 위한 helm fetch

$ helm fetch gitlab/gitlab --untar --version 6.8.1

$ cd gitlab

values.yaml 파일 수정

$ vi values.yaml
  1. hosts: ingress에서 host로 사용될 도메인 설정
    ('gitlab', 'minio', 'registry', 'kas'의 도메인을 default 값으로 두고 싶다면 각각의 name:을 입력하는 부분은 생략)

    hosts:
      domain: mydomain.com
      hostSuffix:
      https: true
      externalIP:
      ssh: ~
      gitlab:
        # name: my-gitlab.mydomain.com  # default: gitlab
      minio:
        # name: my-minio.mydomain.com  # default: minio
      registry:
        # name: my-registry.mydomain.com  # default: registry
      tls: {}
      smartcard: {}
      kas:
        # name: my-kas.mydomain.com  # default: kas
      pages: {}
      ...
  2. ingress: AWS Load Balancer Controller 사용 (설치 방법)

    ingress.annotations 설정 시 주의

    • alb.ingress.kubernetes.io/group.name가 없으면 Service에서 다음과 같은 에러가 발생함
    Failed deploy model due to DuplicateLoadBalancerName: A load balancer with the same name '<생성할_LB_NAME>' exists, but with different settings
    • alb.ingress.kubernetes.io/load-balancer-name가 없으면 LB 생성 시 네이밍은 다음과 같이 임의로 지정됨
    k8s-<group.name>-xxxxxxxxxx-xxxxxxxxxx
    • alb.ingress.kubernetes.io/target-type을 'ip'가 아닌 'instance'로 지정할 경우, ingress의 backend로 지정된 service의 type은 'CluserIP'가 아닌 'NodePort'로 지정되어야 함
    ingress:
      apiVersion: ""
      configureCertmanager: false
      provider: aws
      class: alb
      annotations:
        alb.ingress.kubernetes.io/scheme: internet-facing
        alb.ingress.kubernetes.io/target-type: ip
        alb.ingress.kubernetes.io/load-balancer-name: <생성할_LB_NAME>
        alb.ingress.kubernetes.io/subnets: <SUBNET_ID_1>,<SUBNET_ID_2>
        alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:<REGION-CODE>:<ACCOUNT_ID>:certificate/<CERTIFICATE_ID>
        alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]'
        alb.ingress.kubernetes.io/ssl-redirect: '443'
        alb.ingress.kubernetes.io/group.name: 'gitlab'  # (필수) 설정할 그룹명을 입력 -> 그룹'명' 자체가 중요하진 않지만 한 LB에 여러 ingress가 붙을 수 있도록 해주는 설정이기 때문에 필수
      enabled: true
      tls: {}
      path: /
      pathType: Prefix
  3. prometheus: 미설치

    prometheus:
      install: false  # false로 변경
      ...
  4. postgresql: 버전 변경

    설치하는 GitLab 버전에서 지원 가능한 PostgreSQL 버전 사용 필요 (PostgreSQL versions shipped with the Linux package)

    === NOTICE
    The minimum required version of PostgreSQL is now 13. See https://gitlab.com/gitlab-org/charts/gitlab/-/blob/master/doc/installation/upgrade.md for more details.
    postgresql:
      postgresqlUsername: gitlab  # PostgreSQL Username 변경
      postgresqlPostgresPassword: bogus  # PostgreSQL Password 변경
      install: true
      postgresqlDatabase: gitlabhq_production
      image:
        tag: 13.12.0  # 버전 변경
    		  ...
  5. gitlab-runner: privileged 설정 및 cache 설정 제거

    gitlab-runner:
      install: true
      rbac:
        create: true
      runners:
        locked: false
        config: |
          [[runners]]
            [runners.kubernetes]
            image = "ubuntu:18.04"
            privileged = true  # docker in docker 설정 (https://docs.aws.amazon.com/ko_kr/cli/latest/userguide/getting-started-source-install.html)
      podAnnotations:
        gitlab.com/prometheus_scrape: "true"
        gitlab.com/prometheus_port: 9252

GitLab 설치

$ helm install gitlab gitlab/gitlab -f ./values.yaml
$ kubectl get ingress
NAME                        CLASS   HOSTS                   ADDRESS                                                             PORTS     AGE
gitlab-kas                  alb     kas.mydomain.com        <LB_NAME>.ap-northeast-2.elb.amazonaws.com   80, 443   73m
gitlab-minio                alb     minio.mydomain.com      <LB_NAME>.ap-northeast-2.elb.amazonaws.com   80, 443   73m
gitlab-registry             alb     registry.mydomain.com   <LB_NAME>.ap-northeast-2.elb.amazonaws.com   80, 443   73m
gitlab-webservice-default   alb     gitlab.mydomain.com     <LB_NAME>.ap-northeast-2.elb.amazonaws.com   80, 443   73m

Reference

개인적으로 공부하며 작성한 글로, 내용에 오류가 있을 수 있습니다.

profile
클라우드 엔지니어 ♡

0개의 댓글