Skip to content

Commit c8a151b

Browse files
authored
Merge pull request #53498 from aireilly/fix-telcodocs-597
TELCODOCS-597 - Add verification steps to configuring local image registry
2 parents 95382a9 + e5aa12e commit c8a151b

File tree

4 files changed

+136
-58
lines changed

4 files changed

+136
-58
lines changed
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// scalability_and_performance/ztp-advanced-policy-config.adoc
3+
// * scalability_and_performance/ztp_far_edge/ztp-advanced-policy-config.adoc
44

55
:_module-type: CONCEPT
66
[id="ztp-add-local-reg-for-sno-duprofile_{context}"]
@@ -9,13 +9,11 @@
99
{product-title} manages image caching using a local registry. In edge computing use cases, clusters are often subject to bandwidth restrictions when communicating with centralized image registries, which might result in long image download times.
1010

1111
Long download times are unavoidable during initial deployment. Over time, there is a risk that CRI-O will erase the `/var/lib/containers/storage` directory in the case of an unexpected shutdown.
12+
To address long image download times, you can create a local image registry on remote managed clusters using GitOps ZTP. This is useful in Edge computing scenarios where clusters are deployed at the far edge of the network.
1213

13-
To address long image download times, you can create a local image registry on the remote managed cluster using GitOps ZTP. This is useful in Edge computing scenarios where clusters are deployed on the far edge of the network.
14+
Before you can set up the local image registry with GitOps ZTP, you need to configure disk partitioning in the `SiteConfig` CR that you use to install the remote managed cluster. After installation, you configure the local image registry using a `PolicyGenTemplate` CR. Then, the ZTP pipeline creates Persistent Volume (PV) and Persistent Volume Claim (PVC) CRs and patches the `imageregistry` configuration.
1415

1516
[NOTE]
1617
====
17-
The local image registry can only be used for user application images and cannot be used for the {product-title} or Operator Lifecycle Manager operator images. For information about working with these, see Topology Aware Lifecycle Manager (TALM) in Additional resources.
18+
The local image registry can only be used for user application images and cannot be used for the {product-title} or Operator Lifecycle Manager operator images.
1819
====
19-
20-
The first phase of setting up a local image registry is configuring disk partitioning using a `SiteConfig` CR. You can use the `SiteConfig` CR to generate the `MachineConfig` CR used for disk partitioning.
21-
The next phase is to configure the image registry using `PolicyGenTemplate` CRs. The ZTP pipeline uses `PolicyGenTemplate` CRs to create Persistent Volumes (PV) and Persistent Volume Claim (PVC) CRs and patch the `imageregistry` configuration.
Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,46 @@
11
// Module included in the following assemblies:
22
//
3-
// scalability_and_performance/ztp-deploying-disconnected.adoc
3+
// * scalability_and_performance/ztp_far_edge/ztp-advanced-policy-config.adoc
44

55
:_module-type: PROCEDURE
66
[id="ztp-configuring-disk-partitioning_{context}"]
77
= Configuring disk partitioning with SiteConfig
88

9-
Use a `SiteConfig` CR to generate the `MachineConfig` CR used for disk partitioning. Prior to installation, you need to modify values in the `SiteConfig` CR to reflect dependencies on the underlying disk.
9+
Configure disk partitioning for a managed cluster using a `SiteConfig` CR and GitOps ZTP. The disk partition details in the `SiteConfig` CR must match the the underlying disk.
1010

1111
[NOTE]
1212
====
13-
You must use persistent naming for devices to avoid device names such as `/dev/sda` and `/dev/sdb` being switched at every reboot. You can use `rootDeviceHints` to choose the bootable device and then use same device for further partitioning: in this case, for Image registry.
13+
Use persistent naming for devices to avoid device names such as `/dev/sda` and `/dev/sdb` being switched at every reboot. You can use `rootDeviceHints` to choose the bootable device and then use same device for further partitioning.
1414
====
1515

1616
.Prerequisites
1717

18-
* You have installed and configured Zero Touch Provisioning (ZTP). For information about this, see the topic on ZTP in Additional resources.
18+
* You have installed the OpenShift CLI (`oc`).
19+
20+
* You have logged in to the hub cluster as a user with `cluster-admin` privileges.
21+
22+
* You have created a Git repository where you manage your custom site configuration data for use with GitOps Zero Touch Provisioning (ZTP).
1923
2024
.Procedure
2125

22-
. Add the following YAML to the `SiteConfig` CR that you use to generate the `MachineConfig` CR for disk partitioning:
26+
. Add the following YAML that describes the host disk partitioning to the `SiteConfig` CR that you use to install the managed cluster:
2327
+
2428
[source,yaml]
2529
----
2630
nodes:
27-
- rootDeviceHints:
31+
rootDeviceHints:
2832
wwn: "0x62cea7f05c98c2002708a0a22ff480ea"
2933
diskPartition:
30-
- device: /dev/disk/by-id/wwn-0x62cea7f05c98c2002708a0a22ff480ea <1>
31-
partitions:
32-
- mount_point: /var/imageregistry
33-
size: 102500 <2>
34-
start: 344844 <3>
34+
- device: /dev/disk/by-id/wwn-0x62cea7f05c98c2002708a0a22ff480ea <1>
35+
partitions:
36+
- mount_point: /var/imageregistry
37+
size: 102500 <2>
38+
start: 344844 <3>
3539
----
36-
<1> This setting depends on the hardware. The setting can be a serial number or device name. The value must match the entry for `rootDeviceHint`.
40+
<1> This setting depends on the hardware. The setting can be a serial number or device name. The value must match the value set for `rootDeviceHints`.
3741
<2> The minimum value for `size` is 102500 MiB.
3842
<3> The minimum value for `start` is 25000 MiB. The total value of `size` and `start` must not exceed the disk size, or the installation will fail.
43+
44+
. Save the `SiteConfig` CR and push it to the site configuration repo.
45+
46+
The ZTP pipeline provisions the cluster using the `SiteConfig` CR and configures the disk partition.
Lines changed: 106 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,170 @@
11
// Module included in the following assemblies:
22
//
3-
// scalability_and_performance/ztp-advanced-policy-config.adoc
3+
// * scalability_and_performance/ztp_far_edge/ztp-advanced-policy-config.adoc
44

55
:_module-type: PROCEDURE
66
[id="ztp-configuring-pgt-image-registry_{context}"]
77
= Configuring the image registry using PolicyGenTemplate CRs
88

9-
You can use `PolicyGenTemplate` to apply to create the PV and PVC and patch `imageregistry` configuration. Select the appropriate `PolicyGenTemplate` for each `source-cr`. See Additional Resources for more help.
9+
Use `PolicyGenTemplate` (PGT) CRs to apply the CRs required to configure the image registry and patch the `imageregistry` configuration.
1010

1111
.Prerequisites
1212

13-
* You have installed and configured Zero Touch Provisioning (ZTP). For information about this, see the topic on ZTP in Additional resources.
13+
* You have configured a disk partition in the managed cluster.
14+
15+
* You have installed the OpenShift CLI (`oc`).
16+
17+
* You have logged in to the hub cluster as a user with `cluster-admin` privileges.
18+
19+
* You have created a Git repository where you manage your custom site configuration data for use with GitOps Zero Touch Provisioning (ZTP).
1420
1521
.Procedure
1622

17-
. Configure the storage class, persistent volume claim, persistent volume, and image registry configuration in the appropriate `PolicyGenTemplate` CR. For example, to configure an individual site, use the following YAML:
23+
. Configure the storage class, persistent volume claim, persistent volume, and image registry configuration in the appropriate `PolicyGenTemplate` CR. For example, to configure an individual site, add the following YAML to the file `example-sno-site.yaml`:
1824
+
1925
[source,yaml]
2026
----
2127
sourceFiles:
22-
# storage class
23-
- fileName: StorageClass.yaml
24-
policyName: "sc-for-image-registry"
25-
metadata:
26-
name: image-registry-sc
27-
annotations:
28-
ran.openshift.io/ztp-deploy-wave: "100" <1>
28+
# storage class
29+
- fileName: StorageClass.yaml
30+
policyName: "sc-for-image-registry"
31+
metadata:
32+
name: image-registry-sc
33+
annotations:
34+
ran.openshift.io/ztp-deploy-wave: "100" <1>
2935
# persistent volume claim
30-
- fileName: StoragePVC.yaml
36+
- fileName: StoragePVC.yaml
3137
policyName: "pvc-for-image-registry"
3238
metadata:
3339
name: image-registry-pvc
3440
namespace: openshift-image-registry
35-
annotations:
36-
ran.openshift.io/ztp-deploy-wave: "100" <2>
41+
annotations:
42+
ran.openshift.io/ztp-deploy-wave: "100"
3743
spec:
3844
accessModes:
39-
ReadWriteMany
45+
- ReadWriteMany
4046
resources:
4147
requests:
4248
storage: 100Gi
4349
storageClassName: image-registry-sc
4450
volumeMode: Filesystem
4551
# persistent volume
46-
- fileName: ImageRegistryPV.yaml <3>
52+
- fileName: ImageRegistryPV.yaml <2>
4753
policyName: "pv-for-image-registry"
4854
metadata:
4955
annotations:
50-
ran.openshift.io/ztp-deploy-wave: "100" <4>
51-
# image registry config
52-
- fileName: ImageRegistryConfig.yaml <5>
56+
ran.openshift.io/ztp-deploy-wave: "100"
57+
- fileName: ImageRegistryConfig.yaml
5358
policyName: "config-for-image-registry"
54-
complianceType: musthave <5>
59+
complianceType: musthave
5560
metadata:
5661
annotations:
57-
ran.openshift.io/ztp-deploy-wave: "100" <6>
62+
ran.openshift.io/ztp-deploy-wave: "100"
5863
spec:
5964
storage:
6065
pvc:
6166
claim: "image-registry-pvc"
6267
----
63-
<1> Set the appropriate value for `ztp-deploy-wave` depending on whether you are configuring image registries at the site, common, or group level. `ztp-deploy-wave: "100"` is appropriate for an individual site. ZTP deploy waves are used to order how policies are applied to the spoke cluster. All policies created by `PolicyGen` have a ztp deploy wave by default.
64-
<2> Set the appropriate value for `ztp-deploy-wave` as in note 1.
65-
<3> This assumes that `mount_point` is set to `/var/imageregistry` in `SiteConfig` using StorageClass `image-registry-sc` (see the topic on configuring disk partitioning with `SiteConfig`).
66-
<4> Set the appropriate value for `ztp-deploy-wave` as in note 1.
67-
<5> Configure registry to point to the PVC created above.
68-
<6> Set the appropriate value for `ztp-deploy-wave` as in note 1.
68+
<1> Set the appropriate value for `ztp-deploy-wave` depending on whether you are configuring image registries at the site, common, or group level. `ztp-deploy-wave: "100"` is suitable for development or testing because it allows you to group the referenced source files together.
69+
<2> In `ImageRegistryPV.yaml`, ensure that the `spec.local.path` field is set to `/var/imageregistry` to match the value set for the `mount_point` field in the `SiteConfig` CR.
70+
71+
+
72+
[IMPORTANT]
73+
====
74+
Do not set `complianceType: mustonlyhave` for the `- fileName: ImageRegistryConfig.yaml` configuration. This can cause the registry pod deployment to fail.
75+
====
76+
77+
. Commit the `PolicyGenTemplate` change in Git, and then push to the Git repository being monitored by the GitOps ZTP ArgoCD application.
6978

7079
.Verification
7180

72-
. Check that the `Config` CRD of the group `imageregistry.operator.openshift.io` instance is not reporting errors. Run the following command:
81+
Use the following steps to troubleshoot errors with the local image registry on the managed clusters:
7382

74-
. Check that the `PersistentVolumeClaim` on the managed cluster is populated with data. Run the following command:
83+
* Verify successful login to the registry while logged in to the managed cluster. Run the following commands:
7584
76-
. Check that the `registry*` pod is up correctly located under the `openshift-image-registry` namespace.
85+
.. Export the managed cluster name:
86+
+
87+
[source,terminal]
88+
----
89+
$ cluster=<managed_cluster_name>
90+
----
7791

78-
. Verify successful login to the registry with `podman`:
92+
.. Get the managed cluster `kubeconfig` details:
7993
+
8094
[source,terminal]
8195
----
82-
$ oc login -u kubeadmin -p <password_from_install_log> https://api-int.<cluster_name>.<base_domain>:6443
96+
$ oc get secret -n $cluster $cluster-admin-password -o jsonpath='{.data.password}' | base64 -d > kubeadmin-password-$cluster
8397
----
98+
99+
.. Download and export the cluster `kubeconfig`:
84100
+
85101
[source,terminal]
86102
----
87-
$ podman login -u kubeadmin -p $(oc whoami -t) image-registry.openshift-image-registry.svc:5000
103+
$ oc get secret -n $cluster $cluster-admin-kubeconfig -o jsonpath='{.data.kubeconfig}' | base64 -d > kubeconfig-$cluster && export KUBECONFIG=./kubeconfig-$cluster
88104
----
89105

90-
. Check for disk partitioning using `lsblk` to list your blocks:
106+
.. Verify access to the image registry from the managed cluster. See "Accessing the registry".
107+
108+
* Check that the `Config` CRD in the `imageregistry.operator.openshift.io` group instance is not reporting errors. Run the following command while logged in to the managed cluster:
91109
+
92110
[source,terminal]
93111
----
94-
$ oc debug node/sno-1.example.com
112+
$ oc get image.config.openshift.io cluster -o yaml
113+
----
114+
+
115+
.Example output
116+
[source,yaml]
117+
----
118+
apiVersion: config.openshift.io/v1
119+
kind: Image
120+
metadata:
121+
annotations:
122+
include.release.openshift.io/ibm-cloud-managed: "true"
123+
include.release.openshift.io/self-managed-high-availability: "true"
124+
include.release.openshift.io/single-node-developer: "true"
125+
release.openshift.io/create-only: "true"
126+
creationTimestamp: "2021-10-08T19:02:39Z"
127+
generation: 5
128+
name: cluster
129+
resourceVersion: "688678648"
130+
uid: 0406521b-39c0-4cda-ba75-873697da75a4
131+
spec:
132+
additionalTrustedCA:
133+
name: acm-ice
95134
----
96135
97-
. When you enter the node, run the following command:
136+
* Check that the `PersistentVolumeClaim` on the managed cluster is populated with data. Run the following command while logged in to the managed cluster:
137+
+
138+
[source,terminal]
139+
----
140+
$ oc get pv image-registry-sc
141+
----
142+
143+
* Check that the `registry*` pod is running and is located under the `openshift-image-registry` namespace.
144+
+
145+
[source,terminal]
146+
----
147+
$ oc get pods -n openshift-image-registry | grep registry*
148+
----
149+
+
150+
.Example output
151+
[source,terminal]
152+
----
153+
cluster-image-registry-operator-68f5c9c589-42cfg 1/1 Running 0 8d
154+
image-registry-5f8987879-6nx6h 1/1 Running 0 8d
155+
----
156+
157+
* Check that the disk partition on the managed cluster is correct:
158+
159+
.. Open a debug shell to the managed cluster:
160+
+
161+
[source,terminal]
162+
----
163+
$ oc debug node/sno-1.example.com
164+
----
98165

166+
.. Run `lsblk` to check the host disk partitions:
167+
+
99168
[source,terminal]
100169
----
101170
sh-4.4# lsblk
@@ -109,4 +178,4 @@ sda 8:0 0 446.6G 0 disk
109178
sdb 8:16 0 446.6G 0 disk
110179
sr0 11:0 1 104M 0 rom
111180
----
112-
<1> This setting will appear if you have successfully listed your block.
181+
<1> `/var/imageregistry` indicates that the disk is correctly partitioned.

scalability_and_performance/ztp_far_edge/ztp-advanced-policy-config.adoc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,19 @@ include::modules/ztp-configuring-ptp-fast-events.adoc[leveloffset=+1]
4242
4343
include::modules/ztp-add-local-reg-for-sno-duprofile.adoc[leveloffset=+1]
4444

45+
[role="_additional-resources"]
46+
.Additional resources
47+
48+
* For more information about container image registries, see xref:../../registry/index.adoc#registry-overview[{product-title} registry overview].
49+
4550
include::modules/ztp-configuring-disk-partitioning.adoc[leveloffset=+2]
4651

4752
include::modules/ztp-configuring-pgt-image-registry.adoc[leveloffset=+2]
4853

4954
[role="_additional-resources"]
5055
.Additional resources
5156

52-
* For more information about configuring GitOps ZTP on the hub cluster, see xref:../../scalability_and_performance/ztp_far_edge/ztp-preparing-the-hub-cluster.adoc#ztp-preparing-the-hub-cluster[Preparing the hub cluster for ZTP]
53-
54-
* For more information about container image registries, see xref:../../registry/index.adoc#registry-overview[{product-title} registry overview].
57+
* xref:../../registry/accessing-the-registry.adoc#accessing-the-registry[Accessing the registry]
5558
5659
include::modules/ztp-configuring-hwevents-using-pgt.adoc[leveloffset=+1]
5760

0 commit comments

Comments
 (0)