VK Cloud logo
Updated at April 15, 2024   08:50 AM

Installing and configuring Harbor

In this article, we will look at how to install and configure Harbor repository repositories. After that, you can configure application auto-deployment to a Kubernetes cluster.

Installing the Harbor repository repository

Before installing Harbor:

  1. Install and configure Docker.
  2. Install and configure GitLab.

Harbor is installed as a Docker image using the online installer.

To install the Harbor repositories:

  1. Download the online installer script and unzip it:
root@ubuntu-std3-2-4-40gb:~# wget https://github.com/goharbor/harbor/releases/download/v1.9.3/harbor-online-installer-v1.9.3.tgzroot@ubuntu-std3-2-4-40gb:~# tar -zxvf harbor-online-installer-v1.9.3.tgz
  1. In the resulting harbor folder, configure the harbor.yml file:
hostname: <SERVER_DNS_NAME>http:    # port for http, default is 80. If https enabled, this port will redirect to https port    port: 8080# https related config    https:# # https port for harbor, default is 443    port: 8443# # The path of cert and key files for nginx    certificate: /opt/gitlab/config/ssl/<SERVER_DNS_NAME>.crt    private_key: /opt/gitlab/config/ssl/<SERVER_DNS_NAME>.key# The default data volumedata_volume: /opt/harbor

And:

  • The hostname is the same as the GitLab name because the deployment is done on the server that hosts GitLab.
  • Non-standard HTTP and HTTPS ports are used, as the standard ones are used by the GitLab web interface.
  • Uses the LetsEncrypt certificate and key that was created when you set up GitLab.
  1. Run the install.sh script:
root@ubuntu-std3-2-4-40gb:~/harbor# ./install.sh[Step 0]: checking installation environment ...Note: docker version: 19.03.5Note: docker-compose version: 1.25.0[Step 1]: preparing environment ...[Step 2]: starting Harbor ...Creating harbor-log ... doneCreating registryctl ... doneCreating redis ... doneCreating harbor-db ... doneCreating harbor portal ... doneCreating registry ... doneCreating harbor-core ... doneCreating nginx ... doneCreating harbor-jobservice ... done✔ ----Harbor has been installed and started successfully.----

Harbor launched.

Setting up the repository repository Harbor

  1. Log in to Harbor.

Since we are using non-standard ports, the URL will look like this:

https://<SERVER_DNS_NAME>:8443

The default login is admin. The primary password is set in the harbor.yml file (default is Harbor12345).

  1. Change the password for the admin user. To do this, click on admin in the upper right corner and select Change Password:

  1. Specify the current and new passwords:

  1. Create a user under which GitLab will work with Harbor. To do this, select Users on the left:

  1. Specify the data of the new user:

  1. Create a new project that will contain the built images from GitLab. To do this, select Projects on the left:

  1. Enter the details of the new project:

  1. Add a user to the project:

  1. Specify a name and role for the user:

Now set up auto-deployment of the application to the Kubernetes cluster.