Skip to content

Commit e67e18d

Browse files
committed
Update Blog “setting-up-harbor-as-a-local-container-registry-in-hpe-private-cloud-ai”
1 parent 74246f3 commit e67e18d

File tree

1 file changed

+34
-28
lines changed

1 file changed

+34
-28
lines changed

content/blog/setting-up-harbor-as-a-local-container-registry-in-hpe-private-cloud-ai.md

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,51 +56,53 @@ Additionally, the default *values.yaml* file has been modified with the followin
5656
persistence.persistentVolumeClaim.registry.size = 500G
5757
```
5858

59-
These updates are reflected in the revised *Harbor* Helm charts, available in the *GitHub* repository [*pcai-helm-examples*](https://github.com/GuopingJia/pcai-helm-examples/tree/main/harbor). With these customizations, *Harbor* can be seamlessly deployed into PCAI using the *Import Framework*:
59+
These updates are implemented in the revised *Harbor* Helm charts, available in the *GitHub* repository [*pcai-helm-examples*](https://github.com/GuopingJia/pcai-helm-examples/tree/main/harbor). With these customizations, *Harbor* can be seamlessly deployed into PCAI using the *Import Framework*:
6060

6161
![](/img/import-harbor.png)
6262

6363
### Harbor UI access via its endpoint
6464

65-
After *Harbor* is installed through PCAI *Import Framework*, an **Imported** *Harbor* tile is added to *Tools & Frameworks*, under *Data Science* tab. A virtual service endpoint, e.g., *https://harbor.ingress.pcai0104.ld7.hpecolo.net*, has been configured and exposed for *Harbor* access.
65+
After *Harbor* is deployed via the PCAI *Import Framework*, an **Imported** *Harbor* tile appears under *Tools & Frameworks* on the *Data Science* tab. A virtual service endpoint, e.g., *https://harbor.ingress.pcai0104.ld7.hpecolo.net*, is automatically configured and exposed, providing access to *Harbor*.
6666

6767
![](/img/harbor-deployment.png)
6868

69-
Simply clicking *Open* button, or copying the endpoint URL to the browser, the *Harbor* login page shows up in a new window:
69+
Click the *Open* button, or paste the endpoint URL into your browser, to launch the *Harbor* login page:
7070

7171
![](/img/harbor-login.png)
7272

73-
Using the default Harbor *admin* user credentials, you can log into *Harbor* projects page:
73+
From there, you can log into *Harbor* projects page using the default *admin* user credentials:
7474

7575
![](/img/harbor-ui.png)
7676

7777
### Harbor project and user creation
7878

79-
*Harbor* manages container images through projects. A project contains all image repositories of an application. Images cannot be pushed to *Harbor* before a project is created. By default, there is a public project *library* pre-created. You can create your project by clicking *+ NEW PRORJECT*:
79+
*Harbor* manages container images through projects, each of which hosts the image repositories for your application. Before pushing images to *Harbor*, a project must first be created. A default public project named *library* is pre-created, but new projects can be created by clicking *+ NEW PRORJECT*:
8080

8181
![](/img/create-project.png)
8282

83-
You should always create a private project to restrict any user to pull images from the *Harbor* project. The private project *demo* is created using the default unlimited (**-1**) quota. However, you can add quota, e.g., *500G*, to limit project usage of registry capacity, in your production setup.
83+
For security, it's recommended to create *private* projects to restrict unauthorized images pulls. In this blog post, a private project named *demo* is created with an unlimited quota (**-1**). In production environments, setting a defined quota, e.g., *500G*, can help manage registry storage usage.
8484

85-
You can then create users and add them as the members to a project using RBAC.
85+
Next, users can be created and assigned to projects using role-based access control (RBAC).
8686

87-
In this section, two users, *pcai-developer*, & *pcai-admin*, are created:
87+
Two users, *pcai-developer*, & *pcai-admin*, are created:
8888

8989
![](/img/two-users-harbor.png)
9090

91-
In addition to the default admin user, these two newly created users have been added as members to the project *demo* with the role *Developer* and *Maintainer*, respectively. The user *pcai-developer* has read and write privileges for the project, while *pcai-admin* has elevated permissions including the ability to scan images, view replication jobs and delete images.
91+
These users, along with the default *admin* user, are added to the project *demo* with distinct roles:
92+
* *pcai-developer* has **Developer** role (with read/write access to project)
93+
* *pcai-admin* is assigned the **Maintainer** role, with extended privileges including image scanning, replication job visibility and image deletion
9294

9395
![](/img/project-member.png)
9496

95-
Please refer to [Harbor Managing Users](https://goharbor.io/docs/2.13.0/administration/managing-users/) for the detailed permissions in each role. As a best practice in production environment, it’s highly recommended to set up users with different role assignments in *Harbor*.
97+
For a detailed breakdown of each role's capabilities, refer to the official [Harbor Managing Users page](https://goharbor.io/docs/2.13.0/administration/managing-users/). As a best practice, production deployments should enforce role separation to maintain security and operational clarity in *Harbor*.
9698

9799
### Pushing Images to Harbor Registry
98100

99-
With the project and users created, you can now push the container images using the following steps:
101+
With the project and users set up, you're ready to push the container images to *Harbor* by following these steps:
100102

101-
* *Log into Harbor registry*
103+
* *Log in to Harbor registry*
102104

103-
Log into *Harbor* registry from the Docker client by running the command using the user *pcai-admin* credentials:
105+
Use the Docker client to authenticate with the *Harbor* registry using the *pcai-admin* user credentials, by running the following command :
104106

105107
```shell
106108
$ docker login harbor.ingress.pcai0104.ld7.hpecolo.net
@@ -114,19 +116,24 @@ https://docs.docker.com/go/credential-store/
114116
Login Succeeded
115117
```
116118

117-
If you get any certificate error when trying to log in from your Linux client, you can edit the file */etc/docker/daemon.json* to add the line below, by replacing the *Harbor* registry URL with your own one.
119+
If you get any certificate error when logging in from a Linux client, update the file */etc/docker/daemon.json* by adding the following entry, replacing the *Harbor* registry URL with your own:
118120

119121
```shell
120122
{
121123
"insecure-registries" : [" harbor.ingress.pcai0104.ld7.hpecolo.net "]
122124
}
123125
```
124126

125-
You need to run *'systemctl daemon-reload'* and restart the *docker* service after you edit the file */etc/docker/daemon.json*.
127+
After making this change, reload the daemon and resart the Docker service:
128+
129+
```shell
130+
$ sudo systemctl daemon-reload
131+
$ sudo systemctl restart docker
132+
```
126133

127134
* *Tag an existing image*
128135

129-
Instead of building a Docker image using a Dockerfile, we pull a sample nginx image, *'pcaidemo/cfe-nginx'*, from *DockerHub* and tag it with the *Harbor* registry URL and project name:
136+
Rather than building a Docker image from a Dockerfile, we'll pull the sample CFE Nginx image, *'pcaidemo/cfe-nginx'*, from *DockerHub* and tag it with the *Harbor* registry URL and project name:
130137

131138
```shell
132139
$ docker images
@@ -143,7 +150,7 @@ harbor.ingress.pcai0104.ld7.hpecolo.net/demo/cfe-nginx v0.1.0 1e5f3c5b981a
143150

144151
* *Pushing the image to Harbor registry*
145152

146-
Push the image to the Harbor registry by running the command:
153+
Push the image to the *Harbor* registry by running the following command:
147154

148155
```shell
149156
$ docker push harbor.ingress.pcai0104.ld7.hpecolo.net/demo/cfe-nginx:v0.1.0
@@ -160,11 +167,11 @@ v0.1.0: digest: sha256:114dff0fc8ee3d0200c3a12c60e3e2b79d0920dd953175ecb78a0b157
160167

161168
* *Verifying the image from Harbor registry*
162169

163-
The image *cfe-nginx* is showing up under *Repositories* tab of the *harbor* project *demo*:
170+
From the *Harbor* UI, the image *cfe-nginx* appears under *Repositories* tab of the *demo* project:
164171

165172
![](/img/demo-project.png)
166173

167-
Log into *Harbor* registry as the user *pcai-developer*, then pull the image from the harbor registry:
174+
Log in to the *Harbor* registry as the *pcai-developer* user, then pull the image *cfe-nginx* from the registry. The image downloads successfully, confirming that the user has appropriate access and the *Harbor* registry is functioning as expected.
168175

169176
```shell
170177
$ docker login harbor.ingress.pcai0104.ld7.hpecolo.net
@@ -199,10 +206,9 @@ harbor.ingress.pcai0104.ld7.hpecolo.net/demo/cfe-nginx v0.1.0 1e5f3c5b981a
199206

200207
## Application deployment using Harbor registry
201208

202-
With images being pushed to *Harbor* registry, let’s try to deploy the application to PCAI using the same *Import Framework* and demonstrate pulling images from the *Harbor* registry.
209+
With the container images pushed to the *Harbor* registry, the next step is to deploy the application to PCAI using the same *Import Framework*, demonstrating how to pull images from *Harbor*.
203210

204-
The Helm charts of the sample Nginx application has been available from GitHub repository [nginx-chart](https://github.com/GuopingJia/pcai-helm-examples/tree/main/nginx-chart). In addition to the *virtualService* and Kyverno *ClusterPolicy* YAML manifest files, the *values.yaml* of the sample Helm charts includes the *imageCredentials* section to provide the *Harbor* access credentials for the user *pcai-developer*. The *imagePullSecrets* uses the Secret resource *harbor*, which is created as part of deployment, for
205-
for pulling images from *Harbor* registry.
211+
The Helm charts of the sample Nginx application are available from GitHub repository [pcai-helm-examples](https://github.com/GuopingJia/pcai-helm-examples/tree/main/nginx-chart). Alongside the required *virtualService* and Kyverno *ClusterPolicy* YAML files, the *values.yaml* file includes the *imageCredentials* section that specifies the *Harbor* access credentials for the *pcai-developer* user. It also references the *imagePullSecrets* field that uses the Secret resource *harbor*, which is created during deployment, to securely pull container images from the *Harbor* registry.
206212

207213
```shell
208214
image:
@@ -221,15 +227,15 @@ imageCredentials:
221227
222228
```
223229

224-
Using this sample Helm charts, the CFE Nginx application can be easily deployed to PCAI using the *Import Framework*. An **Imported** *Nginx* tile shows up under *Tools & Framework*, with its virtual service endpoint:
230+
Using the provided sample Helm charts, the CFE Nginx application can be easily deployed to PCAI via the *Import Framework*. After deployment, an **Imported** *Nginx* tile appears under *Tools & Framework*, along with its configured virtual service endpoint:
225231

226232
![](/img/nginx-deployment.png)
227233

228-
By clicking *Open* button, you land to the CFE Nginx page:
234+
Clicking the *Open* button launches the CFE Nginx main page:
229235

230236
![](/img/nginx-ui.png)
231237

232-
The CFE Nginx application is deployed to the namespace *nginx* in the K8s cluster. If you have access to the cluster, type the following command to see the deployment:
238+
The CFE Nginx application is deployed to the namespace *nginx* in the K8s cluster. If you have access to the cluster, you can verify the deployment by running the following command:
233239

234240
```shell
235241
# kubectl get all -n nginx
@@ -246,14 +252,14 @@ NAME DESIRED CURRENT READY AGE
246252
replicaset.apps/nginx-chart-546476cd99 1 1 1 6s
247253
```
248254

249-
From the namespace *nginx*, the secrete *harbor* with the type *dockerconfigjson* is created. This secret is used when pulling the image from the *Harbor* registry’s private project *demo* during CFE Nginx application deployment:
255+
Within the *nginx* namespace , a *harbor* secret of type *dockerconfigjson* is created. This secret is used to authenticate and pull images from the *demo* private project in the *Harbor* registry during the deployment of the CFE Nginx application:
250256

251257
```shell
252258
# kubectl get secret harbor -n nginx
253259
NAME TYPE DATA AGE
254260
harbor kubernetes.io/dockerconfigjson 1 3m41s
255261
```
256-
Type the following command, you can see the image *cfe-nginx* with tag *v0.1.0* is pulling from the *Harbor* registry:
262+
Type the following command to observe the *cfe-nginx* image, tagged *v0.1.0*, being pulled from the *Harbor* registry:
257263

258264
```shell
259265
[root@ez-master01 ~]# k describe pod/nginx-chart-546476cd99-2nqzz -n nginx
@@ -274,7 +280,7 @@ Events:
274280
Normal Created 2m16s kubelet Created container nginx-chart
275281
Normal Started 2m16s kubelet Started container nginx-chart
276282
```
277-
The *Logs* page of *Harbor* registry contains all the audit logs about project and user creation, image push and pull operations, etc.
283+
The *Logs* page of the *Harbor* UI provides a comprehensive audit trail, capturing key activities such as project and user creation, as well as image push and pull operations:
278284

279285
![](/img/harbor-audit.png)
280286

0 commit comments

Comments
 (0)