Skip to content

Commit ffb186a

Browse files
authored
Merge branch 'gmidha1:main' into main
2 parents 41c312a + d2c122e commit ffb186a

File tree

1 file changed

+62
-42
lines changed

1 file changed

+62
-42
lines changed

documentation/modules/ROOT/pages/04-workshop.adoc

Lines changed: 62 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,28 @@ In this workshop, we will look at how we utilize our internal container registry
1313

1414
== Delivering the workshop
1515

16-
1. To deploy an internal registry on the bastion, you can follow these steps:
16+
=== Deploying Internal Registry
17+
18+
* Download oc-mirror cli:
1719
+
1820
[.console-input]
1921
[source,shell script]
2022
----
2123
curl -L -o oc-mirror.tar.gz https://mirror.openshift.com/pub/openshift-v4/amd64/clients/ocp/4.18.0-rc.8/oc-mirror.tar.gz;tar -xzf oc-mirror.tar.gz;chmod u+x oc-mirror
2224
2325
----
24-
+
25-
2. Create a pull secret file, you can get your pull secret from console.redhat.com and paste it in the file:
26+
27+
* Create a pull secret file, you can get your pull secret from console.redhat.com and paste it in the file:
2628
+
2729
[.console-input]
2830
[source,shell script]
2931
----
3032
vi ./openshift_pull.json
3133
----
3234
+
33-
3.
34-
Create this bash script for creating an internal registry:
35+
36+
37+
* Create this bash script for creating an internal registry:
3538
+
3639
[.console-input]
3740
[source,shell script]
@@ -98,8 +101,8 @@ podman create --name registry --net host --security-opt label=disable --replace
98101
[ "$?" == "0" ] || !!
99102
100103
----
101-
+
102-
4. Create registry by running:
104+
105+
* Create registry by running:
103106
+
104107
[.console-input]
105108
[source,shell script]
@@ -108,16 +111,16 @@ chmod u+x ./registry.sh
108111
sudo ./registry.sh
109112
sudo podman start registry
110113
----
111-
+
112-
5. Check registry status by using the following command:
114+
115+
* Check registry status by using the following command:
113116
+
114117
[.console-input]
115118
[source,shell script]
116119
----
117120
sudo podman ps
118121
----
119-
+
120-
6. Make changes to ensure registry is reachable from jump box and management nodes. Add an entry in /etc/hosts for registry.hypervisor in 127.0.0.1 line on jump box/bastion.
122+
123+
* Make changes to ensure registry is reachable from jump box and management nodes. Add an entry in /etc/hosts for registry.hypervisor in 127.0.0.1 line on jump box/bastion.
121124
+
122125
[.console-input]
123126
[source,shell script]
@@ -127,23 +130,28 @@ sudo vi /etc/hosts
127130
+
128131
image::dns-change.png[width=100%]
129132
+
130-
Add an entry to dnsmasq so that registry dns is accessible from OpenShift. Add this line: host-record=registry.hypervisor,192.168.125.1
133+
134+
* Add an entry to dnsmasq so that registry dns is accessible from OpenShift. Add this line: host-record=registry.hypervisor,192.168.125.1
131135
+
132136
[.console-input]
133137
[source,shell script]
134138
----
135139
sudo vi /opt/dnsmasq/include.d/infrastructure-host.ipv4
136140
----
137-
+
138-
7. Restart dnsmasq using the below command:
141+
142+
143+
* Restart dnsmasq using the below command:
139144
+
140145
[.console-input]
141146
[source,shell script]
142147
----
143148
sudo systemctl restart dnsmasq-virt
144149
----
145-
+
146-
8. Create a file named imageset.yaml using the following code:
150+
151+
152+
=== Copying images to internal registry and adding configs to the cluster:
153+
154+
* Create a file named imageset.yaml using the following code:
147155
+
148156
[.console-input]
149157
[source,shell script]
@@ -189,16 +197,17 @@ mirror:
189197
helm: {}
190198
EOF
191199
----
192-
+
193-
9. Generate Credentials to be used by oc-mirror command:
200+
201+
* Generate Credentials to be used by oc-mirror command:
194202
+
195203
[.console-input]
196204
[source,shell script]
197205
----
198206
sudo podman login registry.hypervisor:5000 --authfile=/home/lab-user/openshift_pull.json;mkdir -p $XDG_RUNTIME_DIR/containers/;sudo cp /home/lab-user/openshift_pull.json $XDG_RUNTIME_DIR/containers/auth.json;sudo mkdir -p /root/.docker;sudo cp $XDG_RUNTIME_DIR/containers/auth.json /root/.docker/config.json
199207
----
200-
+
201-
10. Run oc-mirror cli command to mirror the images:
208+
209+
210+
* Run oc-mirror cli command to mirror the images:
202211
+
203212
[.console-input]
204213
[source,shell script]
@@ -212,15 +221,15 @@ image::oc-mirror1.png[width=100%]
212221
image::oc-mirror2.png[width=100%]
213222
image::oc-mirror3.png[width=100%]
214223

215-
Login to OpenShift using this cli command and add the Registry CA to the Management Cluster
224+
* Login to OpenShift using this cli command and add the Registry CA to the Management Cluster
216225

217226
[.console-input]
218227
[source,shell script]
219228
----
220229
oc login -u <user> -p <password> <apiserver_url>
221230
----
222231

223-
Grab the cert from /opt/registry/certs/domain.crt and add in this yaml to create a configmap
232+
* Grab the cert from /opt/registry/certs/domain.crt and add in this yaml to create a configmap
224233

225234
[.console-input]
226235
[source,shell script]
@@ -236,15 +245,15 @@ data:
236245
-----END CERTIFICATE-----
237246
----
238247

239-
Before applying this configmap, validate your yaml using this tool.
248+
* Before applying this configmap, validate your yaml using this tool.
240249

241250
[.console-input]
242251
[source,shell script]
243252
----
244253
oc apply -f registry-config.yaml
245254
----
246255

247-
Now we need to patch the clusterwide object image.config.openshift.io including this:
256+
* Now we need to patch the clusterwide object image.config.openshift.io including this:
248257

249258
[.console-input]
250259
[source,shell script]
@@ -261,26 +270,29 @@ spec:
261270
name: registry-config
262271
----
263272

264-
Update the registry creds in the Management cluster. If this command prompts for username and password: dummy/dummy.
273+
* Update the registry creds in the Management cluster. If this command prompts for username and password: dummy/dummy.
265274

266275
[.console-input]
267276
[source,shell script]
268277
----
269278
sudo podman logout registry.hypervisor:5000 ;sudo podman login registry.hypervisor:5000 --authfile=./mycreds.json; sudo chmod 666 ./mycreds.json;oc set data secret/pull-secret -n openshift-config --from-file=.dockerconfigjson=./mycreds.json
270279
----
271-
As the mirroring process is complete, apply the YAML files from the results directory to the cluster by running the following command:
280+
281+
* As the mirroring process is complete, apply the YAML files from the results directory to the cluster by running the following command:
272282
[.console-input]
273283
[source,shell script]
274284
----
275285
oc apply -f /home/lab-user/mirror1/working-dir/cluster-resources/itms-oc-mirror.yaml /home/lab-user/mirror1/working-dir/cluster-resources/idms-oc-mirror.yaml
276286
----
277-
After 2 mins, run the below command:
287+
288+
* After 2 mins, run the below command:
278289
[.console-input]
279290
[source,shell script]
280291
----
281292
oc apply -f /home/lab-user/mirror1/working-dir/cluster-resources/cs-redhat-operator-index-v4-<version>.yaml
282293
----
283-
To verify the resources created with above command:
294+
295+
* To verify the resources created with above command:
284296

285297
[.console-input]
286298
[source,shell script]
@@ -289,24 +301,29 @@ oc get imagedigestmirrorset
289301
oc get imagetagmirrorset
290302
oc get catalogsource -n openshift-marketplace
291303
----
292-
To disable the default CatalogSource
304+
305+
=== Deploying Operators from Internal Registry:
306+
307+
* To disable the default CatalogSource
293308
[.console-input]
294309
[source,shell script]
295310
----
296311
oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'
297312
----
298313

299314

300-
RHACM Installation: We are installing RHACM as we need MCE for the cluster provisioning. MCE is required for this setup. You can install MCE only if you prefer.
315+
==== RHACM Installation
316+
317+
We are installing RHACM as we need MCE for the cluster provisioning. MCE is required for this setup. You can install MCE only if you prefer.
301318

302319
image::acm1.png[width=100%]
303320
image::acm2.png[width=100%]
304321
image::acm3.png[width=100%]
305322
image::acm4.png[width=100%]
306323

307-
OpenShift Virtualization Installation
324+
==== OpenShift Virtualization Installation
308325

309-
- Now we will install OpenShift Virtualization using default values:
326+
Now we will install OpenShift Virtualization using default values:
310327

311328
image::virt1.png[width=100%]
312329
image::virt2.png[width=100%]
@@ -315,9 +332,9 @@ image::virt4.png[width=100%]
315332
image::virt5.png[width=100%]
316333
image::virt6.png[width=100%]
317334

318-
Hosted Control Plane Cluster creation:
335+
=== Hosted Control Plane Cluster creation:
319336

320-
- Creating hosted cluster namespace(clusters-disconnected1) and adding the Registry CA and credentials to the HostedCluster namespace.
337+
* Creating hosted cluster namespace(clusters-disconnected1) and adding the Registry CA and credentials to the HostedCluster namespace.
321338

322339
[.console-input]
323340
[source,shell script]
@@ -340,7 +357,7 @@ spec: {}
340357
status: {}
341358
----
342359

343-
- Copy the Registry CA cert from here /opt/registry/certs/domain.crt and create a configmap as shown below.
360+
* Copy the Registry CA cert from here /opt/registry/certs/domain.crt and create a configmap as shown below.
344361

345362
[.console-input]
346363
[source,shell script]
@@ -355,7 +372,8 @@ metadata:
355372
name: user-ca-bundle
356373
namespace: clusters
357374
----
358-
- Create a secret for Hosted Cluster to access the Registry.
375+
376+
* Create a secret for Hosted Cluster to access the Registry.
359377

360378
[.console-input]
361379
[source,shell script]
@@ -364,7 +382,7 @@ oc create secret generic disconnected-secret -n clusters --from-file=.dockerconf
364382
----
365383

366384

367-
- Apply this CRD to create a Hosted Cluster and Node Pool.
385+
* Apply this CRD to create a Hosted Cluster and Node Pool.
368386

369387
[.console-input]
370388
[source,shell script]
@@ -468,7 +486,8 @@ status:
468486
replicas: 0
469487
----
470488

471-
- We can check the status of our Hosted Cluster using the below commands:
489+
* We can check the status of our Hosted Cluster using the below commands:
490+
472491
[.console-input]
473492
[source,shell script]
474493
----
@@ -478,12 +497,14 @@ oc get pod -n clusters-disconnected1
478497
479498
oc get pod -n clusters-disconnected1
480499
----
500+
481501
image::hcpcluster1.png[width=100%]
482502
image::hcpcluster2.png[width=100%]
483503

484-
- We can create kubeconfig file and run oc cli commands as well:
504+
* We can create kubeconfig file and run oc cli commands as well:
505+
506+
** First download the hcp cli, If you face issue in the wget for tls cert, use --no-check-certificate
485507

486-
First download the hcp cli, If you face issue in the wget for tls cert, use --no-check-certificate
487508
[.console-input]
488509
[source,shell script]
489510
----
@@ -494,7 +515,6 @@ wget <hcp_cli_download_url>
494515
tar xvzf hcp.tar.gz
495516
chmod +x hcp
496517
sudo mv hcp /usr/local/bin/.
497-
498518
----
499519

500520
[.console-input]
@@ -511,6 +531,6 @@ oc -n clusters get nodepool
511531

512532
image::hcpcluster3.png[width=100%]
513533

514-
- From OpenShift Console, when we go to Virtual Machines, we see:
534+
** From OpenShift Console, when we go to Virtual Machines, we see:
515535

516536
image::hcpcluster4.png[width=100%]

0 commit comments

Comments
 (0)