Configure Harbor for LAB or PoC Environment (container based). These are series for configuring VEBA (openfaas for vmware event based alerting).
Summary tasks:
- Deploy and configure photon-os. Photon-OS easier to prepare for container (docker) based workloads.
- Install and configure Harbor
Deploy and Configure Photon
- To install photon, download latest from https://github.com/vmware/photon/wiki/Downloading-Photon-OS
Deploy from OVA normally quite easy.
Go to console of the deployed VM and login using these credentials”
Default username: “root”
Default password: “changeme”
- Change the network to static if the LAB or POC doesn’t hanve dhcp.
1 | cat > /etc/systemd/network/10-static-en.network << "EOF" |
Change the new file’s mode bits by running the chmod command:
1
chmod 644 10-static-en.network
Apply the configuration by running the following command:
1 | systemctl restart systemd-networkd |
Clear your VM ID by running command:
1
echo -n > /etc/machine-id
Change the server hostname by editing the file: /etc/hostname
1
2cat /etc/hostname
veba-cliChange the server hostname/IP relationship by editing the file: /etc/hosts
1
2
3
4
5
6
7
8cat /etc/hosts
# Begin /etc/hosts (network card version)
::1 ipv6-localhost ipv6-loopback
127.0.0.1 localhost.localdomain
127.0.0.1 localhost
127.0.0.1 veba-cli
# End /etc/hosts (network card version)
Install and Configure Harbor
These steps refering blog from https://www.virtuallyghetto.com/2020/05/configure-non-secure-harbor-registry-with-tanzu-kubernetes-grid-tkg.html
Install required packages in the photon-os
1
2tdnf -y update
tdnf -y install perlEnable and start the docker client:
1
2systemctl enable docker
systemctl start dockerTo be able to use the Docker client to push containers to our insecure registry, we will need to create the following configuration to allow us to connect and push containers into our insecure registry. In this example, I will be using IP Address of 192.168.110.101 and port 80.
1
2
3
4
5
6cat > /etc/docker/daemon.json << EOF
{
"insecure-registries": ["http://192.168.110.101:80"]
}
EOF
systemctl restart dockerDownload and install Docker Compose which is required to run Harbor:
1
2curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-composeDownload and extract the Harbor Offline Installer:
1
2
3
4curl -L https://github.com/goharbor/harbor/releases/download/v2.1.3/harbor-offline-installer-v2.1.3.tgz -o harbor-offline-installer-v2.1.3.tgz
tdnf -y install tar
tar xvzf harbor-offline-installer*.tgz
rm -f harbor-offline-installer-v2.1.3.tgzChange into harbor directory and edit the harbor.yml configuration file. First, comment out the entire https section as we are just going to be using http. Next, update the following properties with the respective values of your environment and then save the changes and exit.
property value
hostname 192.168.110.101
harbor_admin_password VMware1!
password VMware1!
1 | root@veba-cli [ ~/harbor ]# mv harbor.yml.tmpl harbor.yml |
Run the following command to start the Harbor installation:
1
./install.sh
Test access to harbor private registry
1
2
3
4
5
6
7root@veba-cli [ ~/harbor ]# docker login -u admin -p VMware1! 192.168.110.101:80/library
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded