Skip to content

Commit 9a59024

Browse files
committed
OSDOCS-16880-2: CQAIMG-2: image config and adv features
1 parent 8f9de03 commit 9a59024

20 files changed

+374
-284
lines changed

_attributes/attributes-openshift-dedicated.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
:OCP: OpenShift Container Platform
88
:OCP-short: OpenShift
99
:ocp-version: 4.19
10+
:op-system-base: RHEL
11+
:op-system-base-full: Red{nbsp}Hat Enterprise Linux (RHEL)
1012
:op-system-first: Red Hat Enterprise Linux CoreOS (RHCOS)
1113
:oc-first: pass:quotes[OpenShift CLI (`oc`)]
1214
:cluster-manager-first: Red Hat OpenShift Cluster Manager

modules/images-configuration-allowed.adoc

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
// Module included in the following assemblies:
22
//
33
// * openshift_images/image-configuration.adoc
4-
// * post_installation_configuration/preparing-for-users.adoc
54

65
:_mod-docs-content-type: PROCEDURE
76
[id="images-configuration-allowed_{context}"]
8-
= Adding specific registries
7+
= Adding specific registries to an allowlist
98

10-
You can add a list of registries, and optionally an individual repository within a registry, that are permitted for image pull and push actions by editing the `image.config.openshift.io/cluster` custom resource (CR). {product-title} applies the changes to this CR to all nodes in the cluster.
9+
[role="_abstract"]
10+
You can add an allowlist of registries, or an individual repository, within a registry for image pull and push actions by editing the `image.config.openshift.io/cluster` custom resource (CR).
1111

12-
When pulling or pushing images, the container runtime searches the registries listed under the `registrySources` parameter in the `image.config.openshift.io/cluster` CR. If you created a list of registries under the `allowedRegistries` parameter, the container runtime searches only those registries. Registries not in the list are blocked.
12+
{product-title} applies the changes to this CR to all nodes in the cluster.
1313

14-
[WARNING]
15-
====
16-
When the `allowedRegistries` parameter is defined, all registries, including the `registry.redhat.io` and `quay.io` registries and the default {product-registry}, are blocked unless explicitly listed. If you use the parameter, to prevent pod failure, add the `registry.redhat.io` and `quay.io` registries and the `internalRegistryHostname` to the `allowedRegistries` list, as they are required by payload images within your environment. For disconnected clusters, mirror registries should also be added.
17-
====
14+
When pulling or pushing images, the container runtime searches the registries listed under the `registrySources` parameter in the `image.config.openshift.io/cluster` CR. If you created a list of registries under the `allowedRegistries` parameter, the container runtime searches only those registries. Registries not in your allowlist are blocked.
15+
//false positive vale example block
16+
17+
include::snippets/allowed-registries-warning.adoc[leveloffset=+1]
1818

1919
.Procedure
2020

21-
* Edit the `image.config.openshift.io/cluster` custom resource:
21+
* Edit the `image.config.openshift.io/cluster` custom resource by running the following command:
2222
+
2323
[source,terminal]
2424
----
@@ -41,8 +41,8 @@ metadata:
4141
selfLink: /apis/config.openshift.io/v1/images/cluster
4242
uid: e34555da-78a9-11e9-b92b-06d6c7da38dc
4343
spec:
44-
registrySources: <1>
45-
allowedRegistries: <2>
44+
registrySources:
45+
allowedRegistries:
4646
- example.com
4747
- quay.io
4848
- registry.redhat.io
@@ -51,20 +51,9 @@ spec:
5151
status:
5252
internalRegistryHostname: image-registry.openshift-image-registry.svc:5000
5353
----
54-
<1> Contains configurations that determine how the container runtime should treat individual registries when accessing images for builds and pods. It does not contain configuration for the internal cluster registry.
55-
<2> Specify registries, and optionally a repository in that registry, to use for image pull and push actions. All other registries are blocked.
56-
+
57-
[NOTE]
58-
====
59-
Either the `allowedRegistries` parameter or the `blockedRegistries` parameter can be set, but not both.
60-
====
61-
+
62-
The Machine Config Operator (MCO) watches the `image.config.openshift.io/cluster` resource for any changes to the registries. When the MCO detects a change, it triggers a rollout on nodes in machine config pool (MCP). The allowed registries list is used to update the image signature policy in the `/etc/containers/policy.json` file on each node. Changes to the `/etc/containers/policy.json` file do not require the node to drain.
6354
6455
ifndef::openshift-rosa,openshift-dedicated[]
65-
.Verification
66-
67-
* Enter the following command to obtain a list of your nodes:
56+
. After you make your configuration updates, list your nodes by running the following command:
6857
+
6958
[source,terminal]
7059
----
@@ -79,12 +68,14 @@ NAME STATUS ROLES AGE VERSION
7968
<node_name> Ready control-plane,master 37m v1.27.8+4fab27b
8069
----
8170

82-
. Run the following command to enter debug mode on the node:
71+
. Enter debug mode on the node by running the following command:
8372
+
8473
[source,terminal]
8574
----
8675
$ oc debug node/<node_name>
8776
----
77+
+
78+
Replace <node_name> with the name of your node.
8879

8980
. When prompted, enter `chroot /host` into the terminal:
9081
+
@@ -93,18 +84,18 @@ $ oc debug node/<node_name>
9384
sh-4.4# chroot /host
9485
----
9586

96-
. Enter the following command to check that the registries have been added to the policy file:
87+
.Verification
88+
89+
. Check that the registries are in the policy file by running the following command:
9790
+
9891
[source,terminal]
9992
----
10093
sh-5.1# cat /etc/containers/policy.json | jq '.'
10194
----
10295
+
103-
The following policy indicates that only images from the example.com, quay.io, and registry.redhat.io registries are permitted for image pulls and pushes:
96+
The following policy indicates that only images from the `example.com`, `quay.io`, and `registry.redhat.io` registries are accessible for image pulls and pushes:
10497
+
10598
.Example image signature policy file
106-
[%collapsible]
107-
====
10899
[source,text]
109100
----
110101
{
@@ -188,9 +179,9 @@ The following policy indicates that only images from the example.com, quay.io, a
188179
}
189180
}
190181
----
191-
====
192182
endif::openshift-rosa,openshift-dedicated[]
193-
183+
+
184+
--
194185
[NOTE]
195186
====
196187
If your cluster uses the `registrySources.insecureRegistries` parameter, ensure that any insecure registries are included in the allowed list.
@@ -211,3 +202,4 @@ spec:
211202
- image-registry.openshift-image-registry.svc:5000
212203
----
213204
====
205+
--

modules/images-configuration-blocked-payload.adoc

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
// * openshift_images/image-configuration.adoc
44

55
:_mod-docs-content-type: PROCEDURE
6-
[id="images-configuration-blocked-payload"]
7-
6+
[id="images-configuration-blocked-payload_{context}"]
87
= Blocking a payload registry
98

10-
In a mirroring configuration, you can block upstream payload registries in a disconnected environment using a `ImageContentSourcePolicy` (ICSP) object. The following example procedure demonstrates how to block the `quay.io/openshift-payload` payload registry.
9+
[role="_abstract"]
10+
In a mirroring configuration, you can block upstream payload registries in a disconnected environment by using a `ImageContentSourcePolicy` (ICSP) object.
11+
//oc mirror v2 does not support ICSP; this content needs an update or a note
12+
The following example procedure demonstrates how to block the `quay.io/openshift-payload` payload registry.
1113

1214
.Procedure
15+
1316
. Create the mirror configuration using an `ImageContentSourcePolicy` (ICSP) object to mirror the payload to a registry in your instance. The following example ICSP file mirrors the payload `internal-mirror.io/openshift-payload`:
1417
+
1518
[source,yaml]
@@ -24,7 +27,8 @@ spec:
2427
- internal-mirror.io/openshift-payload
2528
source: quay.io/openshift-payload
2629
----
27-
. After the object deploys onto your nodes, verify that the mirror configuration is set by checking the `/etc/containers/registries.conf` file:
30+
31+
. After the object deploys onto your nodes, verify that the mirror configuration is set by checking the `/etc/containers/registries.conf` custom resource (CR):
2832
+
2933
.Example output
3034
[source,terminal]
@@ -37,13 +41,15 @@ spec:
3741
[[registry.mirror]]
3842
location = "internal-mirror.io/openshift-payload"
3943
----
40-
. Use the following command to edit the `image.config.openshift.io` custom resource file:
44+
45+
. Use the following command to edit the `image.config.openshift.io` CR:
4146
+
4247
[source,terminal]
4348
----
4449
$ oc edit image.config.openshift.io cluster
4550
----
46-
. To block the payload registry, add the following configuration to the `image.config.openshift.io` custom resource file:
51+
52+
. To block the payload registry, add the following configuration to the `image.config.openshift.io` CR:
4753
+
4854
[source,yaml]
4955
----
@@ -54,9 +60,10 @@ spec:
5460
----
5561
5662
.Verification
63+
//can we run a command such as an oc debug or oc edit to look at this file?
5764
* Verify that the upstream payload registry is blocked by checking the `/etc/containers/registries.conf` file on the node.
5865
+
59-
.Example output
66+
.Example `/etc/containers/registries.conf` file
6067
[source,terminal]
6168
----
6269
[[registry]]

modules/images-configuration-blocked.adoc

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
// Module included in the following assemblies:
22
//
33
// * openshift_images/image-configuration.adoc
4-
// * post_installation_configuration/preparing-for-users.adoc
54

65
:_mod-docs-content-type: PROCEDURE
76
[id="images-configuration-blocked_{context}"]
87
= Blocking specific registries
98

10-
You can block any registry, and optionally an individual repository within a registry, by editing the `image.config.openshift.io/cluster` custom resource (CR). {product-title} applies the changes to this CR to all nodes in the cluster.
9+
[role="_abstract"]
10+
You can block any registry, or an individual repository, within a registry by editing the `image.config.openshift.io/cluster` custom resource (CR).
11+
12+
{product-title} applies the changes to this CR to all nodes in the cluster.
1113

1214
When pulling or pushing images, the container runtime searches the registries listed under the `registrySources` parameter in the `image.config.openshift.io/cluster` CR. If you created a list of registries under the `blockedRegistries` parameter, the container runtime does not search those registries. All other registries are allowed.
1315

1416
[WARNING]
1517
====
16-
To prevent pod failure, do not add the `registry.redhat.io` and `quay.io` registries to the `blockedRegistries` list, as they are required by payload images within your environment.
18+
To prevent pod failure, do not add the `registry.redhat.io` and `quay.io` registries to the `blockedRegistries` list. Payload images within your environment require access to these registries.
1719
====
18-
20+
//how does this work for mirror registries?
1921
.Procedure
2022

21-
* Edit the `image.config.openshift.io/cluster` custom resource:
23+
* Edit the `image.config.openshift.io/cluster` custom resource by running the following command:
2224
+
2325
[source,terminal]
2426
----
@@ -41,27 +43,18 @@ metadata:
4143
selfLink: /apis/config.openshift.io/v1/images/cluster
4244
uid: e34555da-78a9-11e9-b92b-06d6c7da38dc
4345
spec:
44-
registrySources: <1>
45-
blockedRegistries: <2>
46+
registrySources:
47+
blockedRegistries:
4648
- untrusted.com
4749
- reg1.io/myrepo/myapp:latest
4850
status:
4951
internalRegistryHostname: image-registry.openshift-image-registry.svc:5000
5052
----
51-
<1> Contains configurations that determine how the container runtime should treat individual registries when accessing images for builds and pods. It does not contain configuration for the internal cluster registry.
52-
<2> Specify registries, and optionally a repository in that registry, that should not be used for image pull and push actions. All other registries are allowed.
53-
+
54-
[NOTE]
55-
====
56-
Either the `blockedRegistries` registry or the `allowedRegistries` registry can be set, but not both.
57-
====
5853
+
59-
The Machine Config Operator (MCO) watches the `image.config.openshift.io/cluster` resource for any changes to the registries. When the MCO detects a change, it drains the nodes, applies the change, and uncordons the nodes. After the nodes return to the `Ready` state, changes to the blocked registries appear in the `/etc/containers/registries.conf` file on each node. During this period, you might experience service unavailability.
54+
You cannot set both the `blockedRegistries` and `allowedRegistries` parameters. You must select one or the other.
6055
6156
ifndef::openshift-rosa,openshift-dedicated[]
62-
.Verification
63-
64-
* Enter the following command to obtain a list of your nodes:
57+
. Get a list of your nodes by running the following command:
6558
+
6659
[source,terminal]
6760
----
@@ -82,6 +75,8 @@ NAME STATUS ROLES AGE VERSION
8275
----
8376
$ oc debug node/<node_name>
8477
----
78+
+
79+
Replace <node_name> with the name of the node you want details about.
8580

8681
. When prompted, enter `chroot /host` into the terminal:
8782
+
@@ -90,14 +85,16 @@ $ oc debug node/<node_name>
9085
sh-4.4# chroot /host
9186
----
9287

93-
. Enter the following command to check that the registries have been added to the policy file:
88+
.Verification
89+
90+
. Verify that the registries are in the policy file by running the following command:
9491
+
9592
[source,terminal]
9693
----
9794
sh-5.1# cat etc/containers/registries.conf
9895
----
9996
+
100-
The following example indicates that images from the `untrusted.com` registry are prevented for image pulls and pushes:
97+
The following example indicates that images from the `untrusted.com` registry are blocked for image pulls and pushes:
10198
+
10299
.Example output
103100
[source,text]

modules/images-configuration-cas.adoc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@
88
= Configuring additional trust stores for image registry access
99

1010
[role="_abstract"]
11-
You can update an `image.config.openshift.io/cluster` custom resource (CR) to include a reference to a config map that includes additional certificate authorities (CAs). You must ensure that these CAs are trusted during image registry access. The config map key is the hostname of a registry with the port for which this CA is to be trusted. The Privacy-Enhanced Mail (PEM) certificate content is the value, for each additional registry CA to trust.
11+
You can add references to a config map that has additional certificate authorities (CAs) to be trusted during image registry access to the `image.config.openshift.io/cluster` custom resource (CR).
1212

1313
.Prerequisites
1414

15-
* Ensure that a CA is PEM-encoded.
15+
* The certificate authorities (CAs) must be PEM-encoded.
1616
1717
.Procedure
1818

19-
. Create a config map in the `openshift-config` namespace. The following example configurations show defined image registry CA that exists in a config map:
19+
. Create a config map in the `openshift-config` namespace, then and use the config map name in the `AdditionalTrustedCA` parameter of the `image.config.openshift.io` CR. This adds CAs that should be trusted when the cluster contacts external image registries.
2020
+
21+
.Image registry CA config map example
2122
[source,yaml]
2223
----
2324
apiVersion: v1
@@ -37,9 +38,12 @@ data:
3738
+
3839
where:
3940
+
40-
`registry-with-port.example.com..5000`:: If the registry has the port, `:` should be replaced with `..`.
41+
`data:registry.example.com:`:: An example hostname of a registry for which this CA is to be trusted.
42+
`data:registry-with-port.example.com..5000:`:: An example hostname of a registry with the port for which this CA is to be trusted. If the registry has a port, such as `registry-with-port.example.com:5000`, `:` must be replaced with `..`.
43+
+
44+
The PEM certificate content is the value for each additional registry CA to trust.
4145
42-
. Configure an additional CA. Ensure that you specify the name of the CA in the AdditionalTrustedCA` parameter of the `image.config.openshift.io` CR. You can then provide additional CAs that must be trusted when contacting external registries.
46+
. Optional. Configure an additional CA by running the following command:
4347
+
4448
[source,terminal]
4549
----

modules/images-configuration-file.adoc

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,12 @@
66
[id="images-configuration-file_{context}"]
77
= Configuring image registry settings
88

9+
[role="_abstract"]
910
You can configure image registry settings by editing the `image.config.openshift.io/cluster` custom resource (CR).
10-
When changes to the registry are applied to the `image.config.openshift.io/cluster` CR, the Machine Config Operator (MCO) performs the following sequential actions:
11-
12-
. Cordons the node
13-
. Applies changes by restarting CRI-O
14-
. Uncordons the node
15-
+
16-
[NOTE]
17-
====
18-
The MCO does not restart nodes when it detects changes.
19-
====
2011

2112
.Procedure
2213

23-
. Edit the `image.config.openshift.io/cluster` custom resource:
14+
. Edit the `image.config.openshift.io/cluster` CR by running the following command:
2415
+
2516
[source,terminal]
2617
----
@@ -32,7 +23,7 @@ The following is an example `image.config.openshift.io/cluster` CR:
3223
[source,yaml]
3324
----
3425
apiVersion: config.openshift.io/v1
35-
kind: Image <1>
26+
kind: Image
3627
metadata:
3728
annotations:
3829
release.openshift.io/create-only: "true"
@@ -43,12 +34,12 @@ metadata:
4334
selfLink: /apis/config.openshift.io/v1/images/cluster
4435
uid: e34555da-78a9-11e9-b92b-06d6c7da38dc
4536
spec:
46-
allowedRegistriesForImport: <2>
37+
allowedRegistriesForImport:
4738
- domainName: quay.io
4839
insecure: false
49-
additionalTrustedCA: <3>
40+
additionalTrustedCA:
5041
name: myconfigmap
51-
registrySources: <4>
42+
registrySources:
5243
allowedRegistries:
5344
- example.com
5445
- quay.io
@@ -60,21 +51,18 @@ spec:
6051
status:
6152
internalRegistryHostname: image-registry.openshift-image-registry.svc:5000
6253
----
63-
<1> `Image`: Holds cluster-wide information about how to handle images. The canonical, and only valid name is `cluster`.
64-
<2> `allowedRegistriesForImport`: Limits the container image registries from which normal users may import images. Set this list to the registries that you trust to contain valid images, and that you want applications to be able to import from. Users with permission to create images or `ImageStreamMappings` from the API are not affected by this policy. Typically only cluster administrators have the appropriate permissions.
65-
<3> `additionalTrustedCA`: A reference to a config map containing additional certificate authorities (CA) that are trusted during image stream import, pod image pull, `openshift-image-registry` pullthrough, and builds. The namespace for this config map is `openshift-config`. The format of the config map is to use the registry hostname as the key, and the PEM certificate as the value, for each additional registry CA to trust.
66-
<4> `registrySources`: Contains configuration that determines whether the container runtime allows or blocks individual registries when accessing images for builds and pods. Either the `allowedRegistries` parameter or the `blockedRegistries` parameter can be set, but not both. You can also define whether or not to allow access to insecure registries or registries that allow registries that use image short names. This example uses the `allowedRegistries` parameter, which defines the registries that are allowed to be used. The insecure registry `insecure.com` is also allowed. The `registrySources` parameter does not contain configuration for the internal cluster registry.
6754
+
6855
[NOTE]
6956
====
70-
When the `allowedRegistries` parameter is defined, all registries, including the registry.redhat.io and quay.io registries and the default {product-registry}, are blocked unless explicitly listed. If you use the parameter, to prevent pod failure, you must add the `registry.redhat.io` and `quay.io` registries and the `internalRegistryHostname` to the `allowedRegistries` list, as they are required by payload images within your environment. Do not add the `registry.redhat.io` and `quay.io` registries to the `blockedRegistries` list.
71-
72-
When using the `allowedRegistries`, `blockedRegistries`, or `insecureRegistries` parameter, you can specify an individual repository within a registry. For example: `reg1.io/myrepo/myapp:latest`.
57+
When you use the `allowedRegistries`, `blockedRegistries`, or `insecureRegistries` parameter, you can specify an individual repository within a registry. For example: `reg1.io/myrepo/myapp:latest`.
7358
74-
Insecure external registries should be avoided to reduce possible security risks.
59+
Avoid insecure external registries to reduce possible security risks.
7560
====
61+
//moved footnotes to reference table
62+
63+
.Verification
7664

77-
. To check that the changes are applied, list your nodes:
65+
. To verify your changes, list your nodes by running the following command:
7866
+
7967
[source,terminal]
8068
----

0 commit comments

Comments
 (0)