Harbor, Helm으로 쿠버네티스에 구축하기(NFS볼륨, HTTPS 인증서설정,Ingress, Harbor Invalid user name or password.)

쿠버네티스 환경에서 Harbor를 Helm으로 구축하는 과정을 상세히 정리하였습니다. 자체 쿠버네티스이므로 볼륨은 NFS 를 사용하였으며 Nginx-Ingress는 NodePort로 노출하였습니다. Harbor 구축 후 Invalid user name or password 로그인이 안되는 이슈로 Harbor-ingress 부분에 대한 상세한 설정이 추가되었습니다.
jongcloud's avatar
Jul 08, 2024
Harbor, Helm으로 쿠버네티스에 구축하기(NFS볼륨, HTTPS 인증서설정,Ingress, Harbor Invalid user name or password.)
 
 
 

1. 인증서 생성하기

Harbor를 helm으로 설치할 시 certSource: auto 로 설정하게 되면 자체 인증서를 생성하여 Kubernetes Secret으로 등록하여 인증서 구성이 가능합니다. 본 가이드에서는 auto 옵션을 사용하여 인증서를 자동 구성하므로 인증서 생성 과정은 생략합니다.
 
자체 인증서 생성하는 방법은 아래에서 확인 가능하며 본 가이드와 같이 auto 옵션을 사용할 경우

자체 인증서 생성하는 방법

본 가이드에서는 harbor의 도메인을 harbor.apps.ocp.test2.com로 가정합니다.
 

1-1. 인증 기관 인증서 생성

  1. CA 인증서 개인 키 생성합니다.
    1. $ openssl genrsa -out ca.key 4096 [root@bastion cert]# openssl genrsa -out ca.key 4096 Generating RSA private key, 4096 bit long modulus (2 primes) ..................................................................................................................................................................................................................................++++ ......................................................................++++ e is 65537 (0x010001)
 
  1. CA 인증서를 생성합니다. 아래 예시를 참고하시기 바랍니다.
    1. openssl req -x509 -new -nodes -sha512 -days 3650 \ -subj "/C=KR/ST=Seoul/L=Seoul/O=Solupia/OU=Personal/CN=Solupia Root CA" \ -key ca.key \ -out ca.crt [root@bastion cert]# openssl req -x509 -new -nodes -sha512 -days 3650 \ > -subj "/C=KR/ST=Seoul/L=Seoul/O=Solupia/OU=Personal/CN=Solupia Root CA" \ > -key ca.key \ > -out ca.crt [root@bastion cert]# ls ca.crt ca.key
      각 필드의 의미는 다음과 같습니다:
      • C: 국가 코드 (KR - South Korea)
      • ST: 주 또는 시 (Seoul)
      • L: 지역 (Seoul)
      • O: 조직명 (Solupia)
      • OU: 조직 내 부서명 (Personal)
      • CN: 공통 이름 (Solupia Root CA)
 

1-2. 서버 인증서 생성

인증서에는 일반적으로 .crt 파일과 .key 파일이 포함되어 있습니다. (예: harbor.apps.ocp.test2.com.crtharbor.apps.ocp.test2.com.key)
 
  1. 개인 키를 생성합니다.
    1. $ openssl genrsa -out harbor.apps.ocp.test2.com.key 4096 [root@bastion cert]# openssl genrsa -out harbor.apps.ocp.test2.com.key 4096 Generating RSA private key, 4096 bit long modulus (2 primes) ....................................++++ ............................................................................................++++ e is 65537 (0x010001)
 
  1. 인증서 서명 요청(CSR)을 생성합니다.
    1. -subj 조직을 반영하도록 옵션의 값을 조정합니다. FQDN을 사용하여 Harbor 호스트에 연결하는 경우 이를 일반이름(CN) 속성으로 지정하고 이를 키 및 CSR 파일 이름에 사용해야 합니다.
       
      💡
      FQDN 이란?
      FQDN (Fully Qualified Domain Name)는 인터넷에서 특정 컴퓨터 또는 호스트를 고유하게 식별하는 데 사용되는 전체 도메인 이름을 의미합니다. FQDN은 다음과 같은 요소로 구성됩니다:
      1. 호스트 이름 (Host Name): 네트워크 내에서 개별 장치를 식별하는 이름입니다.
      1. 도메인 이름 (Domain Name): 호스트가 속한 도메인을 식별하는 이름입니다.
      1. 최상위 도메인 (Top-Level Domain, TLD): 도메인의 가장 상위 계층을 나타내는 이름입니다. 예: .com, .org, .net

      예시

      • www.example.com
        • www: 호스트 이름
        • example: 도메인 이름
        • com: 최상위 도메인 (TLD)
       
      본 가이드는 FQDN 도메인 이므로 위의 설명에 따라 아래 예시를 참고하여 작성합니다.
      openssl req -sha512 -new \ -subj "/C=KR/ST=Seoul/L=Seoul/O=Solupia/OU=Personal/CN=harbor.apps.ocp.test2.com" \ -key harbor.apps.ocp.test2.com.key \ -out harbor.apps.ocp.test2.com.csr [root@bastion cert]# openssl req -sha512 -new \ > -subj "/C=KR/ST=Seoul/L=Seoul/O=Solupia/OU=Personal/CN=harbor.apps.ocp.test2.com" \ > -key harbor.apps.ocp.test2.com.key \ > -out harbor.apps.ocp.test2.com.csr [root@bastion cert]# ls ca.crt ca.key harbor.apps.ocp.test2.com.csr harbor.apps.ocp.test2.com.key
      줄바꿈에 주의한다.
  1. x509 v3 확장 파일을 생성합니다.
    1. Harbor 호스트에 연결하기 위해 FQDN 또는 IP 주소를 사용하든 관계없이 이 파일을 만들어야 SAN(Subject Alternative Name) 및 x509 v3 확장 요구 사항을 준수하는 Harbor 호스트에 대한 인증서를 생성할 수 있습니다. DNS도메인을 반영하도록 항목을 바꿉니다.
       
      아래 예시처럼 작성할 수 있습니다.
      cat > v3.ext <<-EOF authorityKeyIdentifier=keyid,issuer basicConstraints=CA:FALSE keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment extendedKeyUsage = serverAuth subjectAltName = @alt_names [alt_names] DNS.1=harbor.apps.ocp.test2.com DNS.2=harbor EOF [root@bastion cert]# cat > v3.ext <<-EOF > authorityKeyIdentifier=keyid,issuer > basicConstraints=CA:FALSE > keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment > extendedKeyUsage = serverAuth > subjectAltName = @alt_names > > [alt_names] > DNS.1=harbor.apps.ocp.test2.com > DNS.2=harbor > EOF [root@bastion cert]# ls ca.crt ca.key harbor.apps.ocp.test2.com.csr harbor.apps.ocp.test2.com.key v3.ext
 
  1. 해당 파일을 사용하여 v3.ext Harbor 호스트에 대한 인증서를 생성합니다.
    1.  
      harbor.apps.ocp.test2.com CSR 및 CRT 파일 이름을 Harbor 호스트 이름으로 바꿔서 진행합니다. 아래 예시처럼 진행할 수 있습니다.
      openssl x509 -req -sha512 -days 3650 \ -extfile v3.ext \ -CA ca.crt -CAkey ca.key -CAcreateserial \ -in harbor.apps.ocp.test2.com.csr \ -out harbor.apps.ocp.test2.com.crt [root@bastion cert]# openssl x509 -req -sha512 -days 3650 \ > -extfile v3.ext \ > -CA ca.crt -CAkey ca.key -CAcreateserial \ > -in harbor.apps.ocp.test2.com.csr \ > -out harbor.apps.ocp.test2.com.crt Signature ok subject=C = KR, ST = Seoul, L = Seoul, O = Solupia, OU = Personal, CN = harbor.apps.ocp.test2.com Getting CA Private Key [root@bastion cert]# ls ca.crt ca.key ca.srl harbor.apps.ocp.test2.com.crt harbor.apps.ocp.test2.com.csr harbor.apps.ocp.test2.com.key v3.ext
      이 명령어는 다음과 같은 작업을 수행합니다:
      • req -sha512 -days 3650: 3650일 동안 유효한 인증서를 생성합니다.
      • extfile v3.ext: SAN 및 x509 v3 확장을 포함하는 v3.ext 파일을 지정합니다.
      • CA ca.crt -CAkey ca.key -CAcreateserial: 인증서 서명에 사용할 CA 인증서와 키를 지정하고, CA 시리얼 파일을 생성합니다.
      • in harbor.apps.ocp.test2.com.csr: CSR 파일을 지정합니다.
      • out harbor.apps.ocp.test2.com.crt: 생성된 인증서 파일을 지정합니다.

1-3. Secret 생성

앞서 만든 인증서를 쿠버네티스 Secret으로 생성합니다.
  • --cert--key 경로의 앞서 만든 인증서의 경로와 인증서를 작성합니다.
kubectl create secret tls harbor-tls --cert=/root/jongwoon/harbor/cert/harbor.apps.ocp.test2.com.crt --key=/root/jongwoon/harbor/cert/harbor.apps.ocp.test2.com.key -n harbor
 
 

2. Helm 설치 전 사전 준비

본 과정에서는 Helm 설치에 앞서 사전 준비사항에 대해 가이드합니다. 네임스페이스 생성, Secret 생성, Ingress 설치, PV,PVC,StorageClass 생성, values.yaml 작성이 포함됩니다.

2-1. 네임스페이스 생성

Harbor 설치를 위한 네임스페이스를 생성합니다.
kubectl create namespace harbor
 

2-2. Ingress 설치(LB가 아닌 NodePort)

일반적으로 Ingress Controller는 LB를 통해 노출하나 이 가이드에 환경에서는 NodePort로 노출합니다.
vi ingress-nginx-controller-nodeport.yaml
apiVersion: apps/v1 kind: Deployment metadata: name: ingress-nginx-controller namespace: ingress-nginx labels: app.kubernetes.io/name: ingress-nginx app.kubernetes.io/part-of: ingress-nginx spec: replicas: 1 selector: matchLabels: app.kubernetes.io/name: ingress-nginx app.kubernetes.io/part-of: ingress-nginx template: metadata: labels: app.kubernetes.io/name: ingress-nginx app.kubernetes.io/part-of: ingress-nginx spec: containers: - name: controller image: k8s.gcr.io/ingress-nginx/controller:v1.0.0 args: - /nginx-ingress-controller - --publish-service=$(POD_NAMESPACE)/ingress-nginx-controller - --election-id=ingress-controller-leader - --ingress-class=nginx env: - name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace ports: - name: http containerPort: 80 - name: https containerPort: 443 readinessProbe: httpGet: path: /healthz port: 10254 scheme: HTTP periodSeconds: 10 successThreshold: 1 failureThreshold: 3 timeoutSeconds: 1 livenessProbe: httpGet: path: /healthz port: 10254 scheme: HTTP initialDelaySeconds: 10 periodSeconds: 10 successThreshold: 1 failureThreshold: 3 timeoutSeconds: 1 --- apiVersion: v1 kind: Service metadata: name: ingress-nginx-controller namespace: ingress-nginx labels: app.kubernetes.io/name: ingress-nginx app.kubernetes.io/part-of: ingress-nginx spec: type: NodePort ports: - name: http port: 80 nodePort: 30080 targetPort: http - name: https port: 443 nodePort: 31445 targetPort: https selector: app.kubernetes.io/name: ingress-nginx app.kubernetes.io/part-of: ingress-nginx
 

2-2-1. 적용

kubectl create namespace ingress-nginx kubectl apply -f ingress-nginx-controller-nodeport.yaml

2-3. PV,PVC,StorageClass 생성(NFS 볼륨)

2-3-1. StorageClass 설정

  • vi nfs-storageclass.yaml
    • apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: nfs-harbor provisioner: kubernetes.io/no-provisioner volumeBindingMode: Immediate
 
  • kubectl apply -f nfs-storageclass.yaml
 

2-3-2. PV, PVC 생성 (NFS)

  • NFS 서버는 192.168.1.130이고 경로는 /mnt/shared입니다.
  • PV와 PVC의 이름은 동일해야 합니다.
    • 예를 들어 harbor-jobservice-pvc가 아니라 harbor-jobservice로 명명합니다.
  • NFS 서버의 Path부분은 반드시 사전에 생성되어 있어야 합니다
    • (NFS볼륨 생성 시 NFS 서버에서 하위경로 자동으로 폴더 생성하지 않음)
apiVersion: v1 kind: PersistentVolume metadata: name: harbor-registry namespace: harbor spec: capacity: storage: 8Gi volumeMode: Filesystem accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain storageClassName: nfs-harbor nfs: server: 192.168.1.130 path: /mnt/shared/harbor-registry --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: harbor-registry namespace: harbor spec: storageClassName: nfs-harbor accessModes: - ReadWriteOnce resources: requests: storage: 8Gi --- apiVersion: v1 kind: PersistentVolume metadata: name: harbor-jobservice namespace: harbor spec: capacity: storage: 3Gi volumeMode: Filesystem accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain storageClassName: nfs-harbor nfs: server: 192.168.1.130 path: /mnt/shared/harbor-jobservice --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: harbor-jobservice namespace: harbor spec: storageClassName: nfs-harbor accessModes: - ReadWriteOnce resources: requests: storage: 3Gi --- apiVersion: v1 kind: PersistentVolume metadata: name: harbor-database namespace: harbor spec: capacity: storage: 3Gi volumeMode: Filesystem accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain storageClassName: nfs-harbor nfs: server: 192.168.1.130 path: /mnt/shared/harbor-database --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: harbor-database namespace: harbor spec: storageClassName: nfs-harbor accessModes: - ReadWriteOnce resources: requests: storage: 3Gi --- apiVersion: v1 kind: PersistentVolume metadata: name: harbor-redis namespace: harbor spec: capacity: storage: 3Gi volumeMode: Filesystem accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain storageClassName: nfs-harbor nfs: server: 192.168.1.130 path: /mnt/shared/harbor-redis --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: harbor-redis namespace: harbor spec: storageClassName: nfs-harbor accessModes: - ReadWriteOnce resources: requests: storage: 3Gi --- apiVersion: v1 kind: PersistentVolume metadata: name: harbor-trivy namespace: harbor spec: capacity: storage: 4Gi volumeMode: Filesystem accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain storageClassName: nfs-harbor nfs: server: 192.168.1.130 path: /mnt/shared/harbor-trivy --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: harbor-trivy namespace: harbor spec: storageClassName: nfs-harbor accessModes: - ReadWriteOnce resources: requests: storage: 4Gi

3. Helm을 통한 Harbor 설치

Harbor는 Helm을 통한 설치를 지원합니다.
 

3-1. Helm 설치하기

 
  1. Helm이 설치되어 있는지 확인합니다.
    1. $ helm version [root@bastion harbor]# helm version -bash: helm: command not found
 
  1. Helm이 설치되어있지 않다면 Helm을 설치합니다.
    1. curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash [root@bastion helm]# curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 11694 100 11694 0 0 65696 0 --:--:-- --:--:-- --:--:-- 65696 Downloading https://get.helm.sh/helm-v3.15.2-linux-amd64.tar.gz Verifying checksum... Done. Preparing to install helm into /usr/local/bin helm installed into /usr/local/bin/helm
 
  1. Helm repo에 harbor를 추가합니다.
    1. [root@bastion helm]# helm repo add harbor https://helm.goharbor.io WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/openshift/config/auth/kubeconfig "harbor" has been added to your repositories
 

3-2. values.yaml 설정

values.yaml 파일을 생성하여 설치 시 필요한 설정을 정의합니다.
harbor helm 설치 시 values.yaml 파일의 원본은 여기에서 확인가능합니다.
 
  • vi values.yaml
    • expose: type: ingress tls: enabled: true certSource: secret secret: secretName: harbor-tls ingress: hosts: core: harbor.apps.ocp.test2.com annotations: nginx.ingress.kubernetes.io/ssl-redirect: "true" nginx.ingress.kubernetes.io/proxy-body-size: "0" externalURL: https://harbor.apps.ocp.test2.com:31445 persistence: enabled: true persistentVolumeClaim: registry: storageClass: "nfs-harbor" accessMode: ReadWriteOnce existingClaim: harbor-registry jobservice: storageClass: "nfs-harbor" accessMode: ReadWriteOnce existingClaim: harbor-jobservice database: storageClass: "nfs-harbor" accessMode: ReadWriteOnce existingClaim: harbor-database redis: storageClass: "nfs-harbor" accessMode: ReadWriteOnce existingClaim: harbor-redis trivy: storageClass: "nfs-harbor" accessMode: ReadWriteOnce existingClaim: harbor-trivy harborAdminPassword: "Harbor12345"
  • StorageClass를 반드시 명시합니다.
  • 기존 PVC 이름은 harbor-registry, harbor-jobservice, harbor-database, harbor-redis, harbor-trivy로 지정합니다.
  • 사전에 설정된 URL을 externalURL 에 기입합니다.
    • 💡
      주의사항
      • externalURL 에는 harbor.apps.ocp.test2.com:31445 와 같이 포트번호 까지 입력해줘야 합니다. 이때 31445는 ingress service인 ingress-nginx-controller 의 https 포트이며 실제 웹 접속 시 harbor.apps.ocp.test2.com:31445 로 접속하기 때문입니다.
        • ingress-nginx-controller 생성 시 yaml 파일
          ingress-nginx-controller 생성 시 yaml 파일
 
 

3-3. Helm 을 통한 Harbor 설치

 
  1. 아래 명령을 통해 helm 설치를 진행합니다.
    1. helm install harbor harbor/harbor -f values.yaml --namespace harbor
      root@k8s-master-114:~/jongwoon/harbor# k get all -n harbor NAME READY STATUS RESTARTS AGE pod/harbor-core-5b889ffc5b-glqns 1/1 Running 6 (2d18h ago) 2d18h pod/harbor-database-0 1/1 Running 0 2d18h pod/harbor-jobservice-6c4cf96f6d-df8dg 1/1 Running 0 2d18h pod/harbor-portal-9d6d6fbc4-vhfnc 1/1 Running 0 2d18h pod/harbor-redis-0 1/1 Running 0 2d18h pod/harbor-registry-5784fc64c-dpgsf 2/2 Running 0 2d18h pod/harbor-trivy-0 1/1 Running 0 2d18h NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/harbor-core ClusterIP 10.109.190.247 <none> 80/TCP 2d18h service/harbor-database ClusterIP 10.107.172.23 <none> 5432/TCP 2d18h service/harbor-jobservice ClusterIP 10.108.140.66 <none> 80/TCP 2d18h service/harbor-portal ClusterIP 10.103.176.221 <none> 80/TCP 2d18h service/harbor-redis ClusterIP 10.100.205.201 <none> 6379/TCP 2d18h service/harbor-registry ClusterIP 10.106.129.201 <none> 5000/TCP,8080/TCP 2d18h service/harbor-trivy ClusterIP 10.103.178.41 <none> 8080/TCP 2d18h NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/harbor-core 1/1 1 1 2d18h deployment.apps/harbor-jobservice 1/1 1 1 2d18h deployment.apps/harbor-portal 1/1 1 1 2d18h deployment.apps/harbor-registry 1/1 1 1 2d18h NAME DESIRED CURRENT READY AGE replicaset.apps/harbor-core-5b889ffc5b 1 1 1 2d18h replicaset.apps/harbor-jobservice-6c4cf96f6d 1 1 1 2d18h replicaset.apps/harbor-portal-9d6d6fbc4 1 1 1 2d18h replicaset.apps/harbor-registry-5784fc64c 1 1 1 2d18h NAME READY AGE statefulset.apps/harbor-database 1/1 2d18h statefulset.apps/harbor-redis 1/1 2d18h statefulset.apps/harbor-trivy 1/1 2d18h
 
  1. 이때 jobservice 의 pvc 가 pending 상태일 수 있습니다. 이때는 job service의 pvc를 삭제한 뒤 아래 yaml 파일을 통해 pvc만 재구성하시기 바랍니다. (helm 설치 시 jobservice 의 pvc는 같이 설치되기 때문에 미리 설치할 필요가 없습니다 - 이 부분은 추후 테스트 해보겠습니다)
    1. apiVersion: v1 kind: PersistentVolumeClaim metadata: name: harbor-jobservice namespace: harbor annotations: helm.sh/resource-policy: keep meta.helm.sh/release-name: harbor meta.helm.sh/release-namespace: harbor labels: app.kubernetes.io/managed-by: Helm app: harbor component: jobservice spec: storageClassName: nfs-harbor accessModes: - ReadWriteOnce resources: requests: storage: 3Gi volumeMode: Filesystem volumeName: harbor-jobservice
 
  1. harbor 가 helm 설치되면 k edit ingress -n harbor 를 통해 spec.ingressClassName: nginx 을 추가해주시기 바랍니다. 이는 ingress 리소스가 어느 ingress 컨트롤러에 의해 처리될지를 지정하기 위함입니다.
    1. 💡
      확인사항 이 부분에 대해서는 추후 values.yaml에서 expose.ingress.className: "nginx" 를 추가하면 수정이 필요없는지에 대해 테스트 예정입니다.
       
      notion image
       

4. Harbor 접속하기

Harbor의 접속하기에 앞서 몇 가지 설정이 필요합니다.
 

4-1. nginx-ingress가 설치된 node IP를 이용하여 hosts 파일 수정

  1. k get pod -n ingress-nginx -o wide 를 통해 controller가 설치된 Node 를 파악합니다.
    1. notion image
 
  1. 해당 Node의 실제 IP주소로 Hosts 파일을 변경합니다.
    1. notion image
      • 1 의 사진에서 보이는 k8s-worker1-11510.40.0.10 IP는 실제 노드의 IP가 아닌 쿠버네티스 환경에서 할당된 IP기 때문에 Windows의 host 파일에는 실제 k8s-worker1-115노드의 IP주소로 매핑해주어야 합니다. (harbor를 접속하는 Windows와 k8s-worker1-115 노드는 당연히 통신이 되어야 하구요)
 
  1. https://harbor.apps.ocp.test2.com:31455/ 로 접속합니다.
    1. notion image
 
 

5. Harbor 접속 간 네트워크 구성

내 PC (hosts 파일 115 > harborURL) | v ingress-nginx-controller (NodePort 31455) | v harbor-ingress (Ingress Resource) | v harbor-portal (Service) | v harbor-portal (Pod)
  • 네트워크 구성 설명
      1. 내 PC (hosts 파일 설정)
          • 내 PC의 /etc/hosts 파일에 다음과 같은 설정이 있습니다:
            • 192.168.1.115 harbor.apps.ocp.test2.com
          • 이 설정을 통해 harbor.apps.ocp.test2.com 도메인을 브라우저에서 입력하면 192.168.1.115 IP로 접속하게 됩니다.
           
      1. ingress-nginx-controller (NodePort)
          • ingress-nginx-controller 서비스는 NodePort 타입으로 설정되어 있습니다.
          • NodePort 31455를 통해 외부 트래픽을 수신합니다.
          • 브라우저에서 https://harbor.apps.ocp.test2.com:31455로 접속하면 NodePort를 통해 Ingress Controller로 트래픽이 전달됩니다.
          • 여기서 중요한 점은 harbor.apps.ocp.test2.com만 입력했을 때는 NodePort로 접근할 수 없기 때문에 페이지가 뜨지 않는다는 것입니다. 따라서 :31455 포트를 명시해야 합니다.
      1. harbor-ingress (Ingress Resource)
          • Ingress Controller는 harbor-ingress 리소스를 참조하여 라우팅 규칙을 확인합니다.
          • harbor-ingress 리소스는 harbor-portal 서비스로 트래픽을 라우팅합니다.
          • TLS 설정도 여기서 관리됩니다. harbor-tls 인증서를 사용하여 SSL/TLS 트래픽을 처리합니다.
           
      1. harbor-portal (Service)
          • harbor-portal 서비스는 ClusterIP 타입으로 설정되어 있습니다.
          • Ingress Controller에서 오는 트래픽을 해당 서비스로 전달합니다.
          • 이 서비스는 포트 80에서 포트 8080으로 트래픽을 라우팅합니다.
           
      1. harbor-portal (Pod)
          • harbor-portal 서비스는 harbor-portal Pod와 연결되어 있습니다.
          • 최종적으로 트래픽은 harbor-portal Pod로 전달되고, Harbor 웹 인터페이스를 사용자에게 제공합니다.
           
이 구성을 통해 내 PC에서 https://harbor.apps.ocp.test2.com:31455로 접속하면 Harbor 웹 인터페이스에 접근할 수 있습니다. 각 구성 요소는 트래픽을 올바르게 라우팅하여 사용자가 원하는 웹 페이지를 제공하게 됩니다.
 
 

# 추가사항

  • harbor-ingress 수정해서 ingressClassName: nginx 추가 필요
  • 도커 로그인 시 인증서 추가 필요.
    • 헬름에서는 secret 을 통해 인증서를 생성하는데
      kubectl get secret harbor-ingress -n harbor -o jsonpath="{.data['tls\.crt']}" | base64 --decode > harbor.crt
       
      kubectl get secret harbor-ingress -n harbor -o jsonpath="{.data['tls\.key']}" | base64 --decode > harbor.key
       
      를 통해 추출한 뒤
      sudo mkdir -p /etc/docker/certs.d/harbor.apps.ocp.test2.com:31455
      sudo cp harbor.crt /etc/docker/certs.d/harbor.apps.ocp.test2.com:31455/ca.crt
       
      sudo systemctl restart docker
       
      진행 해주어야함
       
      추가 사항에 대해서는 별도의 자료를 만들도록 함
       
Share article

jongcloud