Skip to content

Setting up Basic Harbor Registry in a Kubernetes Cluster

harbor

Let's have kubernetes cluster

curl -s https://raw.githubusercontent.com/naren4b/dotfiles/main/ws/install.sh | bash

Setup Harbor Helm-Chart

curl -s https://raw.githubusercontent.com/naren4b/harbor-registry/main/setup.sh | bash

Install Ingress controller

curl -s  https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml 
kubectl label nodes controlplane ingress-ready="true"
kubectl apply -f deploy.yaml 
kubectl wait --for=condition=ready pod -n ingress-nginx -l app.kubernetes.io/component=controller

Install harbor

curl -O https://raw.githubusercontent.com/naren4b/harbor-registry/main/harbor-values.yaml #change the values if you want 
HARBOR_URL=registry.127.0.0.1.nip.io
curl https://raw.githubusercontent.com/naren4b/harbor-registry/main/install.sh | bash
kubectl wait --for=condition=ready pod -n registry -l app=harbor -l component=portal

Setup Client

URL=$HARBOR_URL
CERT_PATH=/etc/docker/certs.d/${URL}
sudo mkdir -p $CERT_PATH
sudo openssl s_client -connect ${URL}:443 -showcerts </dev/null | sed -n -e '/-.BEGIN/,/-.END/ p' > /etc/docker/certs.d/${URL}/ca.crt
sudo systemctl restart docker
# for any local URL 
echo 127.0.0.1 $URL >> /etc/hosts 

Load an image to registry

docker login registry.127.0.0.1.nip.io -u admin -p Harbor12345
docker pull nginx:latest
docker tag nginx:latest $HARBOR_URL/library/nginx:latest
docker push $HARBOR_URL/library/nginx:latest

NEXT: Let's try basic Harbor API

Ref: - Demo Environment