Skip to content

Commit 0f71748

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

File tree

1 file changed

+43
-139
lines changed

1 file changed

+43
-139
lines changed

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

Lines changed: 43 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ The following sections detail application deployment using the *kubectl* CLI and
3131

3232
The following sections describe in detail how to deploy *Harbor* into PCAI using the *Import Framework*. You will learn how to create a private project, create users and assign them with specific role permissions, and push images using *Harbor* credentials. Used as a local image registry witin PCAI, *Harbor* helps ensure your container images remain secure and well governed.
3333

34-
### Harbor Deployment via PCAI *Import Framework*
34+
### Harbor deployment via PCAI *Import Framework*
3535

36-
Based on the latest Helm charts from the official [*Harbor* site](https://helm.goharbor.io/harbor-1.17.0.tgz), the following required YAML manifest files have been added:
36+
Based on the latest Helm charts from the official [*Harbor* site](https://helm.goharbor.io/harbor-1.17.0.tgz), the following required YAML manifest files have been added under *templates/ezua/*:
3737

3838
* *virtualService.yaml*: an Istio *VirtualService* configuration file to define routing rules for incoming requests.
3939
* *kyverno-cluster-policy*: a Kyverno *ClusterPolicy* file to add the required labels to the deployment.
@@ -61,7 +61,7 @@ Using updated Helm charts, *Harbor* can be easily deployed into PCAI via the *Im
6161

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

64-
2. Harbor UI access via its endpoint
64+
### Harbor UI access via its endpoint
6565

6666
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.
6767

@@ -75,33 +75,33 @@ Using the default Harbor *admin* user credentials, you can log into *Harbor* pro
7575

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

78-
#### Harbor project and user creation
78+
### Harbor project and user creation
7979

8080
*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*:
8181

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

84-
You should always create a private project to restrict any user to pull images from the project. You can further add quota to limit project usage of registry capacity. The *demo* project is created using the default unlimited (-1) quota.
84+
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.
8585

8686
You can then create users and add them as the members to a project using RBAC.
8787

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

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

92-
In addition to the default admin user, these two newly created users have been added as members to the project *demo* with *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.
92+
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.
9393

9494
![](/img/project-member.png)
9595

96-
Please refer to [Harbor Managing Users](https://goharbor.io/docs/2.13.0/administration/managing-users/) for the detailed permissions in each role. In order to more focus on image pushing process and application deployment from Harbor, the project will use its default *admin* user. As a best practice in production environment, it’s highly recommended to set up users with different role assignments in Harbor.
96+
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*.
9797

98-
3. Pushing Images to Harbor Registry
98+
### Pushing Images to Harbor Registry
9999

100-
You can push your images using the following steps:
100+
With the project and users created, you can now push the container images using the following steps:
101101

102-
* *Login to Harbor registry*
102+
* *Log into Harbor registry*
103103

104-
Login to Harbor registry in Docker client by running the command with the user *pcai-admin* credentials:
104+
Log into *Harbor* registry from the Docker client by running the command using the user *pcai-admin* credentials:
105105

106106
```shell
107107
$ docker login harbor.ingress.pcai0104.ld7.hpecolo.net
@@ -115,7 +115,7 @@ https://docs.docker.com/go/credential-store/
115115
Login Succeeded
116116
```
117117

118-
If you get any certificate error when trying to login from your Linux client, you can edit the file */etc/docker/daemon.json* to add the line below:
118+
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.
119119

120120
```shell
121121
{
@@ -127,7 +127,7 @@ You need to run *'systemctl daemon-reload'* and restart the *docker* service aft
127127

128128
* *Tag an existing image*
129129

130-
Instead of building a Docker image using a Dockerfile, we pull a sample nginx image from DockerHub and tag it with the harbor registry URL and project name:
130+
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:
131131

132132
```shell
133133
$ docker images
@@ -161,11 +161,11 @@ v0.1.0: digest: sha256:114dff0fc8ee3d0200c3a12c60e3e2b79d0920dd953175ecb78a0b157
161161

162162
* *Verifying the image from Harbor registry*
163163

164-
The image *cfe-nginx* is showing up under *Repositories* tab of the project *demo*:
164+
The image *cfe-nginx* is showing up under *Repositories* tab of the *harbor* project *demo*:
165165

166166
![](/img/demo-project.png)
167167

168-
Login to Harbor registry with the user *pcai-developer*, then pull the image from the harbor registry:
168+
Log into *Harbor* registry as the user *pcai-developer*, then pull the image from the harbor registry:
169169

170170
```shell
171171
$ docker login harbor.ingress.pcai0104.ld7.hpecolo.net
@@ -198,12 +198,12 @@ REPOSITORY TAG IMAGE ID
198198
harbor.ingress.pcai0104.ld7.hpecolo.net/demo/cfe-nginx v0.1.0 1e5f3c5b981a 2 months ago 192MB
199199
```
200200

201-
## Application Deployment using Harbor Registry
201+
## Application deployment using Harbor registry
202202

203-
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 local Harbor repository.
203+
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.
204204

205-
The Helm charts of the sample Nginx application has been available from GitHub repo at https://github.com/GuopingJia/pcai-helm-examples/tree/main/nginx-chart
206-
The *values.yaml* of the sample Helm charts includes the Harbor access credentials for the user *pcai-developer*. The Secret resource *harbor* is created and it’s used for *imagePullSecrets* for pulling images from Harbor.
205+
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
206+
for pulling images from *Harbor* registry.
207207

208208
```shell
209209
image:
@@ -222,14 +222,18 @@ imageCredentials:
222222
223223
```
224224

225+
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:
226+
225227
![](/img/nginx-deployment.png)
226228

229+
By clicking *Open* button, you land to the CFE Nginx page:
230+
227231
![](/img/nginx-ui.png)
228232

229-
Typing the following command to check the CFE Nginx deployment in the namespace *nginx*:
233+
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:
230234

231235
```shell
232-
# k get all -n nginx
236+
# kubectl get all -n nginx
233237
NAME READY STATUS RESTARTS AGE
234238
pod/nginx-chart-546476cd99-2nqzz 1/1 Running 0 6s
235239

@@ -241,96 +245,23 @@ deployment.apps/nginx-chart 1/1 1 1 6s
241245

242246
NAME DESIRED CURRENT READY AGE
243247
replicaset.apps/nginx-chart-546476cd99 1 1 1 6s
248+
```
249+
250+
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:
251+
252+
```shell
253+
# kubectl get secret harbor -n nginx
254+
NAME TYPE DATA AGE
255+
harbor kubernetes.io/dockerconfigjson 1 3m41s
256+
```
257+
Type the following command, you can see the image *cfe-nginx* with tag *v0.1.0* is pulling from the *Harbor* registry:
258+
259+
```shell
244260
[root@ez-master01 ~]# k describe pod/nginx-chart-546476cd99-2nqzz -n nginx
245261
Name: nginx-chart-546476cd99-2nqzz
246262
Namespace: nginx
247-
Priority: 0
248-
Service Account: default
249-
Node: scs04.pcai0104.ld7.hpecolo.net/172.18.41.111
250-
Start Time: Sat, 28 Jun 2025 14:17:36 +0000
251-
Labels: app=nginx-chart
252-
app.kubernetes.io/instance=nginx-chart
253-
app.kubernetes.io/name=nginx-chart
254-
hpe-ezua/app=nginx-chart
255-
hpe-ezua/ezlicense.vcpu=approved
256-
hpe-ezua/type=vendor-service
257-
pod-template-hash=546476cd99
258-
Annotations: cni.projectcalico.org/containerID: 8861453a40a4a5aaaa98dab8ee00689f2917353746e0e2f4d66b7022157d7def
259-
cni.projectcalico.org/podIP: 10.224.217.20/32
260-
cni.projectcalico.org/podIPs: 10.224.217.20/32
261-
policies.kyverno.io/last-applied-patches:
262-
set-scheduler-for-hpe-ezua-app-service-user-or-vendor-pods.assign-custom-scheduler-for-ezua-user-vendor-pods.kyverno.io: replaced
263-
/spec/schedulerName
264-
Status: Running
265-
IP: 10.224.217.20
266-
IPs:
267-
IP: 10.224.217.20
268-
Controlled By: ReplicaSet/nginx-chart-546476cd99
269-
Init Containers:
270-
web-content:
271-
Container ID: containerd://a9c4826017ef0103e18729e67d1681dbf383ab1acf32330ddc12abc6f38fc0af
272-
Image: busybox
273-
Image ID: docker.io/library/busybox@sha256:f85340bf132ae937d2c2a763b8335c9bab35d6e8293f70f606b9c6178d84f42b
274-
Port: <none>
275-
Host Port: <none>
276-
Command:
277-
/bin/sh
278-
-c
279-
echo "<h1>This is <font color=blue>CFE Nginx app</font> deployed to HPE PCAI using the Nginx image from Harbor registry!</h1>" > /webdata/index.html
280-
State: Terminated
281-
Reason: Completed
282-
Exit Code: 0
283-
Started: Sat, 28 Jun 2025 14:17:38 +0000
284-
Finished: Sat, 28 Jun 2025 14:17:38 +0000
285-
Ready: True
286-
Restart Count: 0
287-
Environment: <none>
288-
Mounts:
289-
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-nxqwk (ro)
290-
/webdata from webdata (rw)
291-
Containers:
292-
nginx-chart:
293-
Container ID: containerd://d5b813d8b2e6c2432b2d2e6ac0a7124b6cc108dc5fe7460ce121db5f9115cac2
294-
Image: harbor.ingress.pcai0104.ld7.hpecolo.net/demo/cfe-nginx:v0.1.0
295-
Image ID: harbor.ingress.pcai0104.ld7.hpecolo.net/demo/cfe-nginx@sha256:114dff0fc8ee3d0200c3a12c60e3e2b79d0920dd953175ecb78a0b157425b25e
296-
Port: 80/TCP
297-
Host Port: 0/TCP
298-
State: Running
299-
Started: Sat, 28 Jun 2025 14:17:39 +0000
300-
Ready: True
301-
Restart Count: 0
302-
Limits:
303-
cpu: 100m
304-
memory: 128Mi
305-
Requests:
306-
cpu: 100m
307-
memory: 128Mi
308-
Environment: <none>
309-
Mounts:
310-
/usr/share/nginx/html from webdata (rw)
311-
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-nxqwk (ro)
312-
Conditions:
313-
Type Status
314-
PodReadyToStartContainers True
315-
Initialized True
316-
Ready True
317-
ContainersReady True
318-
PodScheduled True
319-
Volumes:
320-
webdata:
321-
Type: EmptyDir (a temporary directory that shares a pod's lifetime)
322-
Medium:
323-
SizeLimit: <unset>
324-
kube-api-access-nxqwk:
325-
Type: Projected (a volume that contains injected data from multiple sources)
326-
TokenExpirationSeconds: 3607
327-
ConfigMapName: kube-root-ca.crt
328-
ConfigMapOptional: <nil>
329-
DownwardAPI: true
330-
QoS Class: Burstable
331-
Node-Selectors: <none>
332-
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
333-
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
263+
...
264+
...
334265
Events:
335266
Type Reason Age From Message
336267
---- ------ ---- ---- -------
@@ -344,42 +275,15 @@ Events:
344275
Normal Created 2m16s kubelet Created container nginx-chart
345276
Normal Started 2m16s kubelet Started container nginx-chart
346277
```
347-
348-
From the same namespace *nginx*, the secrete *harbor* has been created with the type *kubernetes.io/dockerconfigjson* :
349-
350-
```shell
351-
# k get secret harbor -n nginx
352-
NAME TYPE DATA AGE
353-
harbor kubernetes.io/dockerconfigjson 1 3m41s
354-
```
355-
356-
This harbor secret is used when pulling the image from the Harbor registry’s private project *demo* during CFE Nginx application deployment:
357-
358-
```shell
359-
# kubectl describe pod/nginx-chart-5cf7969fd4-ct9hw -n nginx
360-
Name: nginx-chart-5cf7969fd4-ct9hw
361-
Namespace: nginx
362-
363-
364-
Events:
365-
Type Reason Age From Message
366-
---- ------ ---- ---- -------
367-
Normal Scheduled 15s scheduler-plugins-scheduler Successfully assigned nginx/nginx-chart-5cf7969fd4-ct9hw to scs04.pcai0104.ld7.hpecolo.net
368-
Normal Pulling 14s kubelet Pulling image "harbor.ingress.pcai0104.ld7.hpecolo.net/demo/cfe-nginx:v0.1.0"
369-
Normal Pulled 14s kubelet Successfully pulled image "harbor.ingress.pcai0104.ld7.hpecolo.net/demo/cfe-nginx:v0.1.0" in 302ms (302ms including waiting)
370-
Normal Created 14s kubelet Created container nginx-chart
371-
Normal Started 13s kubelet Started container nginx-chart
372-
```
278+
The *Logs* page of *Harbor* registry contains all the audit logs about project and user creation, image push and pull operations, etc.
373279

374280
![](/img/harbor-audit.png)
375281

376282
### Conclusion
377283

378-
This blog post offers you a comprehensive guide on how to deploy Harbor to HPE Private Cloud AI and set it up as a local container image registry. By creating a private project, customers can push their Docker image into this local registry.
284+
This blog post offers you a comprehensive guide on how to deploy *Harbor* to HPE Private Cloud AI and set it up as a local container registry. By creating a private *Harbor* project and adding users with the appropriate roles, customers can push their images into this registry and pull them for their application deployment.
379285

380-
Harbor is not just an image registry. It provides security and vulnerability analysis and content signing and validation features to ensure images are scanned and free from vulnerabilities. Organizations have choices to set up users, scan the image and deploy their applications to avoid using any third party container registries like Docker Hub, GitHub container registry, or using cloud providers like Azure Container Registry (ACR), Amazon Elastic Contianer Registry (ECR) or Google Cloud Container Registry (GCR), etc.
286+
Harbor is not just a container registry. It provides security and vulnerability analysis and content signing and validation features to ensure images are scanned and free from vulnerabilities. Organizations have choices to set up users, scan the image and deploy their applications to avoid using any third party container registries like Docker Hub, GitHub container registry, or using cloud providers like Azure Container Registry (ACR), Amazon Elastic Contianer Registry (ECR) or Google Cloud Container Registry (GCR), etc.
381287
This can be used by an organization for hosting the container images for their native cloud applications. To match their security regulation and ….
382288

383-
As of now, HPE Private Cloud AI doesn’t have a service for container registry. By deploying Harbor via PCAI Import Framework,
384-
385289
Please keep coming back to the [HPE Developer Community blog](https://developer.hpe.com/blog/) to learn more about HPE Private Cloud for AI and get more ideas on how you can use it in your everyday operations.

0 commit comments

Comments
 (0)