Skip to content

Commit e360ba4

Browse files
author
Michael Burke
committed
WMCO applies image mirroring settings to Windows instances
1 parent 3479a61 commit e360ba4

6 files changed

+212
-7
lines changed

Diff for: modules/images-configuration-registry-mirror-configuring.adoc

+131-4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,25 @@
33
// * openshift_images/image-configuration.adoc
44
// * post_installation_configuration/preparing-for-users.adoc
55
// * updating/updating_a_cluster/updating_disconnected_cluster/disconnected-update.adoc
6+
// * windows_containers/enabling-windows-container-workloads.adoc
7+
8+
ifeval::["{context}" == "enabling-windows-container-workloads"]
9+
:winc:
10+
endif::[]
611

712
:_mod-docs-content-type: PROCEDURE
813
[id="images-configuration-registry-mirror-configuring_{context}"]
914
= Configuring image registry repository mirroring
1015

1116
You can create postinstallation mirror configuration custom resources (CR) to redirect image pull requests from a source image registry to a mirrored image registry.
1217

18+
ifdef::winc[]
19+
[IMPORTANT]
20+
====
21+
Windows images mirrored through `ImageDigestMirrorSet` and `ImageTagMirrorSet` objects have specific naming requirements. The final portion of the namespace and the image name of the mirror image must match the image being mirrored. For example, when mirroring the `mcr.microsoft.com/oss/kubernetes/pause:3.9` image, the mirror image must have the `<mirror_registry>/<optional_namespaces>/oss/kubernetes/pause:3.9` format. The `optional_namespaces` can be any number of leading repository namespaces.
22+
====
23+
endif::winc[]
24+
1325
.Prerequisites
1426
ifndef::openshift-rosa,openshift-dedicated[]
1527
* Access to the cluster as a user with the `cluster-admin` role.
@@ -22,6 +34,7 @@ endif::openshift-rosa,openshift-dedicated[]
2234

2335
. Configure mirrored repositories, by either:
2436
+
37+
--
2538
* Setting up a mirrored repository with Red Hat Quay, as described in link:https://access.redhat.com/documentation/en-us/red_hat_quay/3/html/manage_red_hat_quay/repo-mirroring-in-red-hat-quay[Red Hat Quay Repository Mirroring]. Using Red Hat Quay allows you to copy images from one repository to another and also automatically sync those repositories repeatedly over time.
2639

2740
* Using a tool such as `skopeo` to copy images manually from the source repository to the mirrored repository.
@@ -30,15 +43,30 @@ For example, after installing the skopeo RPM package on a Red Hat Enterprise Lin
3043
+
3144
[source,terminal]
3245
----
33-
$ skopeo copy \
46+
$ skopeo copy --all \
3447
docker://registry.access.redhat.com/ubi9/ubi-minimal:latest@sha256:5cf... \
3548
docker://example.io/example/ubi-minimal
3649
----
3750
+
3851
In this example, you have a container image registry that is named `example.io` with an image repository named `example` to which you want to copy the `ubi9/ubi-minimal` image from `registry.access.redhat.com`. After you create the mirrored registry, you can configure your {product-title} cluster to redirect requests made of the source repository to the mirrored repository.
52+
--
53+
+
54+
ifdef::winc[]
55+
[IMPORTANT]
56+
====
57+
You must mirror the `mcr.microsoft.com/oss/kubernetes/pause:3.9` image. For example, you could use the following `skopeo` command to mirror the image:
3958
40-
. Log in to your {product-title} cluster.
59+
[source,terminal]
60+
----
61+
$ skopeo copy \
62+
docker://mcr.microsoft.com/oss/kubernetes/pause:3.9\
63+
docker://example.io/oss/kubernetes/pause:3.9
64+
----
65+
====
4166
67+
. Log in to your {product-title} cluster.
68+
endif::winc[]
69+
ifndef::winc[]
4270
. Create a postinstallation mirror configuration CR, by using one of the following examples:
4371
4472
* Create an `ImageDigestMirrorSet` or `ImageTagMirrorSet` CR, as needed, replacing the source and mirrors with your own registry and repository pairs and images:
@@ -85,8 +113,8 @@ spec:
85113
** `imageDigestMirrors`: Use for an `ImageDigestMirrorSet` CR.
86114
** `imageTagMirrors`: Use for an `ImageTagMirrorSet` CR.
87115
<4> Indicates the name of the mirrored image registry and repository.
88-
<5> Optional: Indicates a secondary mirror repository for each target repository. If one mirror is down, the target repository can use another mirror.
89-
<6> Indicates the registry and repository source, which is the repository that is referred to in image pull specifications.
116+
<5> Optional: Indicates a secondary mirror repository for each target repository. If one mirror is down, the target repository can use the secondary mirror.
117+
<6> Indicates the registry and repository source, which is the repository that is referred to in an image pull specification.
90118
<7> Optional: Indicates the fallback policy if the image pull fails:
91119
** `AllowContactingSource`: Allows continued attempts to pull the image from the source repository. This is the default.
92120
** `NeverContactSource`: Prevents continued attempts to pull the image from the source repository.
@@ -115,6 +143,46 @@ spec:
115143
----
116144
<1> Specifies the name of the mirror image registry and repository.
117145
<2> Specifies the online registry and repository containing the content that is mirrored.
146+
endif::winc[]
147+
ifdef::winc[]
148+
. Create an `ImageDigestMirrorSet` or `ImageTagMirrorSet` CR, as needed, replacing the source and mirrors with your own registry and repository pairs and images:
149+
+
150+
[source,yaml]
151+
----
152+
apiVersion: config.openshift.io/v1 <1>
153+
kind: ImageDigestMirrorSet <2>
154+
metadata:
155+
name: ubi9repo
156+
spec:
157+
imageDigestMirrors: <3>
158+
- mirrors:
159+
- example.io/example/ubi-minimal <4>
160+
- example.com/example2/ubi-minimal <5>
161+
source: registry.access.redhat.com/ubi9/ubi-minimal <6>
162+
mirrorSourcePolicy: AllowContactingSource <7>
163+
- mirrors:
164+
- mirror.example.com
165+
source: registry.redhat.io
166+
mirrorSourcePolicy: NeverContactSource
167+
- mirrors:
168+
- docker.io
169+
source: docker-mirror.internal
170+
mirrorSourcePolicy: AllowContactingSource
171+
----
172+
<1> Indicates the API to use with this CR. This must be `config.openshift.io/v1`.
173+
<2> Indicates the kind of object according to the pull type:
174+
** `ImageDigestMirrorSet`: Pulls a digest reference image.
175+
** `ImageTagMirrorSet`: Pulls a tag reference image.
176+
<3> Indicates the type of image pull method, either:
177+
** `imageDigestMirrors`: Use for an `ImageDigestMirrorSet` CR.
178+
** `imageTagMirrors`: Use for an `ImageTagMirrorSet` CR.
179+
<4> Indicates the name of the mirrored image registry and repository.
180+
<5> Optional: Indicates a secondary mirror repository for each target repository. If one mirror is down, the target repository can use another mirror.
181+
<6> Indicates the registry and repository source, which is the repository that is referred to in image pull specifications.
182+
<7> Optional: Indicates the fallback policy if the image pull fails:
183+
** `AllowContactingSource`: Allows continued attempts to pull the image from the source repository. This is the default.
184+
** `NeverContactSource`: Prevents continued attempts to pull the image from the source repository.
185+
endif::winc[]
118186
119187
. Create the new object:
120188
+
@@ -123,7 +191,9 @@ spec:
123191
$ oc create -f registryrepomirror.yaml
124192
----
125193
+
194+
ifndef::winc[]
126195
After the object is created, the Machine Config Operator (MCO) drains the nodes for `ImageTagMirrorSet` objects only. The MCO does not drain the nodes for `ImageDigestMirrorSet` and `ImageContentSourcePolicy` objects.
196+
endif::winc[]
127197
128198
. To check that the mirrored configuration settings are applied, do the following on one of the nodes.
129199
@@ -167,6 +237,7 @@ To use host binaries, run `chroot /host`
167237
sh-4.2# chroot /host
168238
----
169239
240+
ifndef::winc[]
170241
.. Check the `/etc/containers/registries.conf` file to make sure the changes were made:
171242
+
172243
[source,terminal]
@@ -247,6 +318,56 @@ short-name-mode = ""
247318
<3> Indicates that the image pull from the mirror is a digest reference image.
248319
<4> Indicates that the `NeverContactSource` parameter is set for this repository.
249320
<5> Indicates that the image pull from the mirror is a tag reference image.
321+
endif::winc[]
322+
ifdef::winc[]
323+
.. Check that the WMCO generated a `hosts.toml` file for each registry on each Windows instance. For the previous example IDMS object, there should be three files in the following file structure:
324+
+
325+
[source,terminal]
326+
----
327+
$ tree $config_path
328+
----
329+
+
330+
[source,terminal]
331+
.Example output
332+
----
333+
C:/k/containerd/registries/
334+
|── registry.access.redhat.com
335+
| └── hosts.toml
336+
|── mirror.example.com
337+
| └── hosts.toml
338+
└── docker.io
339+
└── hosts.toml:
340+
----
341+
+
342+
The following output represents a `hosts.toml` containerd configuration file where the previous example IDMS object was applied.
343+
+
344+
[source,terminal]
345+
.Example host.toml files
346+
----
347+
$ cat "$config_path"/registry.access.redhat.com/host.toml
348+
server = "https://registry.access.redhat.com" # default fallback server since "AllowContactingSource" mirrorSourcePolicy is set
349+
350+
[host."https://example.io/example/ubi-minimal"]
351+
capabilities = ["pull"]
352+
353+
[host."https://example.com/example2/ubi-minimal"] # secondary mirror
354+
capabilities = ["pull"]
355+
356+
357+
$ cat "$config_path"/registry.redhat.io/host.toml
358+
# "server" omitted since "NeverContactSource" mirrorSourcePolicy is set
359+
360+
[host."https://mirror.example.com"]
361+
capabilities = ["pull"]
362+
363+
364+
$ cat "$config_path"/docker.io/host.toml
365+
server = "https://docker.io"
366+
367+
[host."https://docker-mirror.internal"]
368+
capabilities = ["pull", "resolve"] # resolve tags
369+
----
370+
endif::winc[]
250371
251372
.. Pull an image to the node from the source and check if it is resolved by the mirror.
252373
+
@@ -262,4 +383,10 @@ If the repository mirroring procedure does not work as described, use the follow
262383
* The first working mirror is used to supply the pulled image.
263384
* The main registry is only used if no other mirror works.
264385
* From the system context, the `Insecure` flags are used as fallback.
386+
ifndef::winc[]
265387
* The format of the `/etc/containers/registries.conf` file has changed recently. It is now version 2 and in TOML format.
388+
endif::winc[]
389+
390+
ifeval::["{context}" == "enabling-windows-container-workloads"]
391+
:!winc:
392+
endif::[]

Diff for: modules/images-configuration-registry-mirror.adoc

+30-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
// * openshift_images/image-configuration.adoc
44
// * post_installation_configuration/preparing-for-users.adoc
55
// * updating/updating_a_cluster/updating_disconnected_cluster/disconnected-update.adoc
6+
// * windows_containers/enabling-windows-container-workloads.adoc
7+
8+
ifeval::["{context}" == "enabling-windows-container-workloads"]
9+
:winc:
10+
endif::[]
611

712
:_mod-docs-content-type: CONCEPT
813
[id="images-configuration-registry-mirror_{context}"]
@@ -18,7 +23,12 @@ Repository mirroring in {product-title} includes the following attributes:
1823
* Image pulls are resilient to registry downtimes.
1924
* Clusters in disconnected environments can pull images from critical locations, such as quay.io, and have registries behind a company firewall provide the requested images.
2025
* A particular order of registries is tried when an image pull request is made, with the permanent registry typically being the last one tried.
26+
ifndef::winc[]
2127
* The mirror information you enter is added to the `/etc/containers/registries.conf` file on every node in the {product-title} cluster.
28+
endif::winc[]
29+
ifdef::winc[]
30+
* The mirror information you enter is added to the appropriate `hosts.toml` containerd configuration file(s) on every Windows node in the {product-title} cluster.
31+
endif::winc[]
2232
* When a node makes a request for an image from the source repository, it tries each mirrored repository in turn until it finds the requested content. If all mirrors fail, the cluster tries the source repository. If successful, the image is pulled to the node.
2333
2434
Setting up repository mirroring can be done in the following ways:
@@ -35,14 +45,19 @@ If you did not configure mirroring during {product-title} installation, you can
3545
** `ImageDigestMirrorSet` (IDMS). This object allows you to pull images from a mirrored registry by using digest specifications. The IDMS CR enables you to set a fall back policy that allows or stops continued attempts to pull from the source registry if the image pull fails.
3646
+
3747
** `ImageTagMirrorSet` (ITMS). This object allows you to pull images from a mirrored registry by using image tags. The ITMS CR enables you to set a fall back policy that allows or stops continued attempts to pull from the source registry if the image pull fails.
48+
// Hiding ICSP as it is not supported in WINC
49+
ifndef::winc[]
3850
+
3951
** `ImageContentSourcePolicy` (ICSP). This object allows you to pull images from a mirrored registry by using digest specifications. The ICSP CR always falls back to the source registry if the mirrors do not work.
52+
endif::winc[]
4053
--
54+
ifndef::winc[]
4155
+
4256
[IMPORTANT]
4357
====
4458
Using an `ImageContentSourcePolicy` (ICSP) object to configure repository mirroring is a deprecated feature. Deprecated functionality is still included in {product-title} and continues to be supported; however, it will be removed in a future release of this product and is not recommended for new deployments. If you have existing YAML files that you used to create `ImageContentSourcePolicy` objects, you can use the `oc adm migrate icsp` command to convert those files to an `ImageDigestMirrorSet` YAML file. For more information, see "Converting ImageContentSourcePolicy (ICSP) files for image registry repository mirroring" in the following section.
4559
====
60+
endif::winc[]
4661
4762
Each of these custom resource objects identify the following information:
4863
--
@@ -51,8 +66,22 @@ Each of these custom resource objects identify the following information:
5166
requested from the source repository.
5267
--
5368

69+
ifndef::winc[]
5470
For new clusters, you can use IDMS, ITMS, and ICSP CRs objects as desired. However, using IDMS and ITMS is recommended.
5571

5672
If you upgraded a cluster, any existing ICSP objects remain stable, and both IDMS and ICSP objects are supported. Workloads using ICSP objects continue to function as expected. However, if you want to take advantage of the fallback policies introduced in the IDMS CRs, you can migrate current workloads to IDMS objects by using the `oc adm migrate icsp` command as shown in the *Converting ImageContentSourcePolicy (ICSP) files for image registry repository mirroring* section that follows. Migrating to IDMS objects does not require a cluster reboot.
5773

58-
include::snippets/idms-global-pull-secret.adoc[]
74+
include::snippets/idms-global-pull-secret.adoc[]endif::winc[]
75+
endif::winc[]
76+
ifdef::winc[]
77+
The Windows Machine Config Operator (WMCO) watches for changes to the IDMS and ITMS resources and generates a set of `hosts.toml` containerd configuration files, one file for each source registry, with those changes. The WMCO then updates any existing Windows nodes to use the new registry configuration.
78+
79+
[NOTE]
80+
====
81+
The IDMS and ITMS objects must be created before you can add Windows nodes using a mirrored registry.
82+
====
83+
endif::winc[]
84+
85+
ifeval::["{context}" == "enabling-windows-container-workloads"]
86+
:!winc:
87+
endif::[]

Diff for: modules/machineset-creating.adoc

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ endif::vsphere[]
5959
ifdef::ash[]
6060
* Create an availability set in which to deploy Azure Stack Hub compute machines.
6161
endif::ash[]
62+
ifdef::win[]
63+
* In disconnected environments, the image specified in the `MachineSet` custom resource (CR) must have the link:https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=powershell#install-openssh-for-windows[OpenSSH server v0.0.1.0 installed].
64+
endif::win[]
6265
6366
.Procedure
6467

Diff for: modules/wmco-disconnected-cluster.adoc

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Module included in the following assemblies:
2+
//
3+
// windows_containers/enabling-windows-container-workloads.adoc
4+
5+
:_mod-docs-content-type: CONCEPT
6+
[id="wmco-disconnected-cluster_{context}"]
7+
= Using Windows containers with a mirror registry
8+
9+
The Windows Machine Config Operator (WMCO) can pull images from a registry mirror rather than from a public registry by using an `ImageDigestMirrorSet` (IDMS) or `ImageTagMirrorSet` (ITMS) object to configure your cluster to pull images from the mirror registry.
10+
11+
A mirror registry has the following benefits:
12+
13+
* Avoids public registry outages
14+
* Speeds up node and pod creation
15+
* Pulls images from behind your organization's firewall
16+
17+
A mirror registry can also be used with a {product-title} cluster in a disconnected, or air-gapped, network. A _disconnected network_ is a restricted network without direct internet connectivity. Because the cluster does not have access to the internet, any external container images cannot be referenced.
18+
19+
Using a mirror registry requires the following general steps:
20+
21+
* Create the mirror registry, using a tool such as Red Hat Quay.
22+
* Create a container image registry credentials file.
23+
* Copy the images from your online image repository to your mirror registry.
24+
25+
For information about these steps, see "About disconnected installation mirroring."
26+
27+
After creating the mirror registry and mirroring the images, you can use an `ImageDigestMirrorSet` (IDMS) or `ImageTagMirrorSet` (ITMS) object to configure your cluster to pull images from the mirror registry without needing to update each of your pod specs. The IDMS and ITMS objects redirect requests to pull images from a repository on a source image registry and have it resolved by the mirror repository instead.
28+
29+
If changes are made to the IDMS or ITMS object, the WMCO automatically updates the appropriate `hosts.toml` file on your Windows nodes with the new information. Note that the WMCO sequentially updates each Windows node when mirror settings are changed. As such, the time required for these updates increases with the number of Windows nodes in the cluster.
30+
31+
Also, because Windows nodes configured by the WMCO rely on containerd container runtime, the WMCO ensures that the containerd config files are up-to-date with the registry settings. For new nodes, these files are copied to the instances upon creation. For existing nodes, after activating the mirror registry, the registry controller uses SSH to access each node and copy the generated config files, replacing any existing files.
32+
33+
You can use a mirror registry with machine set or Bring-Your-Own-Host (BYOH) Windows nodes.
34+

Diff for: snippets/idms-global-pull-secret.adoc

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
// * modules/builds-image-source
44
// * modules/images-configuration-registry-mirror
55

6-
:_mod-docs-content-type: SNIPPET
6+
ifeval::["{context}" == "enabling-windows-container-workloads"]
7+
:winc:
8+
endif::[]
79

10+
:_mod-docs-content-type: SNIPPET
811

912
[NOTE]
1013
====

Diff for: windows_containers/enabling-windows-container-workloads.adoc

+10-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Dual NIC is not supported on WMCO-managed Windows instances.
2828

2929
[NOTE]
3030
====
31-
Windows instances deployed by the WMCO are configured with the containerd container runtime. Because WMCO installs and manages the runtime, it is recommanded that you do not manually install containerd on nodes.
31+
Windows instances deployed by the WMCO are configured with the containerd container runtime. Because WMCO installs and manages the runtime, it is recommended that you do not manually install containerd on nodes.
3232
====
3333

3434
[role="_additional-resources"]
@@ -52,6 +52,15 @@ include::modules/wmco-cluster-wide-proxy.adoc[leveloffset=+1]
5252

5353
* xref:../networking/enable-cluster-wide-proxy.adoc#enable-cluster-wide-proxy[Configuring the cluster-wide proxy].
5454

55+
include::modules/wmco-disconnected-cluster.adoc[leveloffset=+1]
56+
57+
.Additional references
58+
59+
* xref:../installing/disconnected_install/index.adoc#installing-mirroring-disconnected-about[About disconnected installation mirroring]
60+
61+
include::modules/images-configuration-registry-mirror.adoc[leveloffset=+2]
62+
63+
include::modules/images-configuration-registry-mirror-configuring.adoc[leveloffset=+2]
5564

5665
[role="_additional-resources"]
5766
== Additional resources

0 commit comments

Comments
 (0)