Harbor 설치 및 구성

Harbor 설치 및 구성

1️⃣ + 단일 노드/멀티 노드 설치

Harbor는 다양한 환경에 배포할 수 있습니다:

환경 유형 설명
단일 노드 테스트/소규모 환경에 적합
멀티 노드 고가용성(HA), 대규모 서비스 운영 시 사용
Kubernetes 기반 마이크로서비스 및 클라우드 환경에서 이상적

1. 단일 노드 구조 예시

┌──────────────────────┐
│      단일 서버       │
│                      │
│  ┌───────┐           │
│  │ Docker│           │
│  └──┬────┘           │
│     ▼                │
│  ┌─────────────┐     │
│  │ Harbor stack│     │
│  └─────────────┘     │
└──────────────────────┘

2. 멀티 노드 구조 예시 (고가용성)

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Node 1    │     │   Node 2    │     │   Node 3    │
│ (UI, Core)  │     │ (Job, DB)   │     │ (Registry)  │
└────┬────────┘     └────┬────────┘     └────┬────────┘
     ▼                       ▼                  ▼
             ┌────────────────────────────┐
             │     Shared DB / Redis      │
             │     Shared Storage (S3)    │
             └────────────────────────────┘

2️⃣ + Docker Compose 기반 설치

Harbor는 기본적으로 Docker Compose로 쉽게 설치할 수 있도록 제공됩니다.


1. 설치 전 준비사항

# Docker, Docker Compose 설치
sudo apt update && sudo apt install docker.io docker-compose -y

2. Harbor 설치 파일 다운로드

wget https://github.com/goharbor/harbor/releases/download/v2.10.0/harbor-online-installer-v2.10.0.tgz
tar -xvf harbor-online-installer-v2.10.0.tgz
cd harbor

3. 설정 파일 수정

cp harbor.yml.tmpl harbor.yml
vim harbor.yml

수정할 주요 항목:

hostname: harbor.local
https:
  port: 443
  certificate: ./cert/harbor.crt
  private_key: ./cert/harbor.key

4. 설치 실행

./install.sh

✅ 설치 후 확인

# 접속
https://harbor.local

# 기본 계정
ID: admin
PW: Harbor12345

3️⃣ + Helm을 통한 Kubernetes에 배포하기

쿠버네티스 환경에서는 Helm Chart를 이용하여 배포할 수 있습니다.


1. Harbor Helm 리포 등록

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

2. 기본 설치

helm install my-harbor harbor/harbor \
  --set expose.type=ingress \
  --set externalURL=https://harbor.example.com

3. 사용자 정의 값 설정 (values.yaml) 예시

expose:
  type: ingress
  tls:
    enabled: true
    secretName: harbor-tls
externalURL: https://harbor.example.com
persistence:
  enabled: true
  persistentVolumeClaim:
    registry:
      size: 50Gi
database:
  type: external
  external:
    host: my-db.example.com

✅ Kubernetes 기반 구성 다이어그램

┌────────────────────┐
│    Ingress (TLS)   │
└────────┬───────────┘
┌────────────────────────────┐
│        Harbor Services     │
├────────────────────────────┤
│ Core, Registry, Job, UI    │
└────────┬───────────────┬───┘
         ▼               ▼
    External DB      Persistent Volumes (PVC)

4️⃣ + 외부 DB/스토리지 연동 구성

1. 외부 DB 연동

  • PostgreSQL, MySQL 등을 외부 인프라로 분리
  • Helm 또는 harbor.yml에서 database.external 설정
database:
  external:
    host: postgres.mydomain.com
    username: harbor
    password: mypass

2. 외부 스토리지 연동

  • NFS, S3, Ceph 등 연동 가능
  • 대용량 저장소 또는 멀티노드 환경에서 필수
storage_service:
  storage_provider_name: s3
  s3:
    accesskey: myaccesskey
    secretkey: mysecretkey
    bucket: harbor-images
    region: us-west-1

5️⃣ + 실습: 로컬 Harbor 구축 및 HTTPS 적용

1. Self-signed 인증서 생성

mkdir cert && cd cert

openssl req -newkey rsa:4096 -nodes -sha256 -keyout harbor.key -x509 -days 365 -out harbor.crt

2. Docker에 인증서 등록

sudo mkdir -p /etc/docker/certs.d/harbor.local
sudo cp harbor.crt /etc/docker/certs.d/harbor.local/ca.crt

3. Harbor 설치 및 HTTPS 확인

  • harbor.yml에 HTTPS 설정
  • install.sh 재실행

✅ 실습 플로우 요약

[로컬 PC]
[Docker + Compose]
[Self-signed TLS 적용]
[Harbor 설치 완료]
접속: https://harbor.local

RSS Feed
마지막 수정일자