본문 바로가기
서버인프라/kubernetes

[Private Container Registry] Harbor

by techwold ted 2024. 4. 15.

오늘은 harbor설치에 대해서 남기려 합니다.

기존에 harbor설치를 하면 대부분 있는 자료가, K8S 환경에서의 harbor설치 입니다. helm을 사용한 설치 이죠

사실 가장 간편한 방법인데, 별도로 harbor를 운영해야 하는경우도 있으니 이번 기회에 자료를 남겨보려 합니다.

 

잠시 다들 아시고 계시겠지만 Harbor에대해 알아볼까요?

기존에 도커환경에서는 Docker Registry를 사용했습니다 굉장히 불편한 환경입니다.

검색이나 서치 할때  UI 제공이 되지 않다보니, API로 검색해야 했습니다.하버의 경우 이쁜 UI와 이미지 스캔을 하여 취약점 검색을 할 수 있습니다. 그리고 Kubernetes, Docker와 같은 클라우드 네이티브 컴퓨팅 플랫폼에서 아티팩트를 일관되고 안전하게 관리 할 수 있도록 지원합니다.

 

https://github.com/goharbor/harbor/releases

 

Releases · goharbor/harbor

An open source trusted cloud native registry project that stores, signs, and scans content. - goharbor/harbor

github.com

위 링크에서 우리는 offline-install-v2.10.2.taz를 다운 받아서 설치 할 것입니다.

wget https://github.com/goharbor/harbor/releases/download/v2.10.2/harbor-offline-installer-v2.10.2.tgz

 

그리고 다운받은 파일을 압축 해제해 줍니다.

 tar -xzvf harbor-offline-installer-v2.10.2.tgz

 

tree로 확인해 보면 아래와 같은 구조를 가진 harbor디렉토리가 나온다면 정상 입니다.

tree harbor
harbor
├── common.sh
├── harbor.v2.10.2.tar.gz
├── harbor.yml.tmpl
├── install.sh
├── LICENSE
└── prepare

 

우선 cp명령을 통해 "harbor.yml.tmpl" 파일을 하나 복사합니다.

cp harbor.yml.tmpl harbor.yml

 

그리고 vi 편집기를 활용하여 몇가지 수정을 해보도록 하겠습니다.

hostname: myharbor

# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 80

# https related config
https:
  # https port for harbor, default is 443
  #port: 443 주석처리
  # The path of cert and key files for nginx 
  #certificate: /your/certificate/path 주석처리
  #private_key: /your/private/key/path 주석처리
  # enable strong ssl ciphers (default: false)
  # strong_ssl_ciphers: false

 

우선 443을 사용하지 않을 것입니다. 이유는 앞단에서  nginx를 통해 https를 처리 할 것입니다.

이렇게 해놓고 다음 단계로 진행해겠습니다.

./prepare
./install.sh

 

# docker images
REPOSITORY                      TAG       IMAGE ID       CREATED        SIZE
goharbor/harbor-exporter        v2.10.2   9befcab0cee2   6 days ago     111MB
goharbor/redis-photon           v2.10.2   9d1db211d49a   6 days ago     170MB
goharbor/trivy-adapter-photon   v2.10.2   8f9e0b6b43ce   6 days ago     509MB
goharbor/harbor-registryctl     v2.10.2   e5a807ba1f59   6 days ago     155MB
goharbor/registry-photon        v2.10.2   850d2b3f27f3   6 days ago     89MB
goharbor/nginx-photon           v2.10.2   9282c21c2fee   6 days ago     159MB
goharbor/harbor-log             v2.10.2   f288fe2baa96   6 days ago     168MB
goharbor/harbor-jobservice      v2.10.2   a3247b57a920   6 days ago     146MB
goharbor/harbor-core            v2.10.2   6cd434d62456   6 days ago     174MB
goharbor/harbor-portal          v2.10.2   7e5a522c7853   6 days ago     167MB
goharbor/harbor-db              v2.10.2   cd385df354d4   6 days ago     274MB
goharbor/prepare                v2.10.2   bf4632d26b65   6 days ago     214MB

 

 

이렇게 많은 images 를 받아오게 되며 아래와 같이 잘 실행 된 것을 볼 수 있습니다.

# docker ps
CONTAINER ID   IMAGE                                 COMMAND                  CREATED          STATUS                    PORTS                                   NAMES
639fe0f48f1a   goharbor/harbor-jobservice:v2.10.2    "/harbor/entrypoint.…"   35 minutes ago   Up 35 minutes (healthy)                                           harbor-jobservice
c3932557c318   goharbor/nginx-photon:v2.10.2         "nginx -g 'daemon of…"   35 minutes ago   Up 35 minutes (healthy)   0.0.0.0:80->8080/tcp, :::80->8080/tcp   nginx
bfc8aa303e80   goharbor/harbor-core:v2.10.2          "/harbor/entrypoint.…"   35 minutes ago   Up 35 minutes (healthy)                                           harbor-core
53b31a81aaf7   goharbor/registry-photon:v2.10.2      "/home/harbor/entryp…"   36 minutes ago   Up 36 minutes (healthy)                                           registry
f66ee768a9d1   goharbor/harbor-registryctl:v2.10.2   "/home/harbor/start.…"   36 minutes ago   Up 35 minutes (healthy)                                           registryctl
f011c11ce07a   goharbor/redis-photon:v2.10.2         "redis-server /etc/r…"   36 minutes ago   Up 35 minutes (healthy)                                           redis
7e52ca835cd8   goharbor/harbor-db:v2.10.2            "/docker-entrypoint.…"   36 minutes ago   Up 35 minutes (healthy)                                           harbor-db
7b819193adab   goharbor/harbor-portal:v2.10.2        "nginx -g 'daemon of…"   36 minutes ago   Up 35 minutes (healthy)                                           harbor-portal
828ed6db9dd5   goharbor/harbor-log:v2.10.2           "/bin/sh -c /usr/loc…"   36 minutes ago   Up 36 minutes (healthy)   127.0.0.1:1514->10514/tcp               harbor-log

 

잘 실행됐네요^^

기본 패스워드는  admin / Harbor12345  입니다. 

 

'서버인프라 > kubernetes' 카테고리의 다른 글

velero backup  (3) 2024.05.07
K8S 기본 볼륨을 nfs로 사용해볼까  (57) 2024.02.01
쿠버네티스 networkpolicy  (68) 2024.01.30
service와 endpoint  (65) 2024.01.25
K8S 리셋  (30) 2023.12.24

댓글