Skip to content

Commit 8973f3e

Browse files
author
Michael Burke
committed
Remove file
1 parent 1304712 commit 8973f3e

File tree

1 file changed

+40
-228
lines changed

1 file changed

+40
-228
lines changed
Lines changed: 40 additions & 228 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,70 @@
11
// Module included in the following assemblies:
22
//
3-
// * machine_configuration/coreos-layering.adoc
3+
// * machine_configuration/mco-coreos-layering.adoc
44

5-
:_mod-docs-content-type: PROCEDURE
5+
:_mod-docs-content-type: CONCEPT
66
[id="coreos-layering-configuring-on_{context}"]
7-
= Using on-cluster layering to apply a custom layered image
7+
= About {image-mode-os-on-lower}
88

9-
To apply a custom layered image to your cluster by using the on-cluster build process, make a `MachineOSConfig` custom resource (CR) that specifies the following parameters:
9+
You can use the {image-mode-os-lower} on-cluster build process to apply a custom layered image to your nodes by creating a `MachineOSConfig` custom resource (CR), as described in "Using {image-mode-os-on-caps} to apply a custom layered image".
1010

11-
* the Containerfile to build
12-
* the machine config pool to associate the build
13-
* where the final image should be pushed and pulled from
14-
* the push and pull secrets to use
15-
16-
When you create the object, the Machine Config Operator (MCO) creates a `MachineOSBuild` object and a builder pod. The build process also creates transient objects, such as config maps, which are cleaned up after the build is complete. The `MachineOSBuild` object and the associated `builder-*` pod use the same naming scheme, `<MachineOSConfig_CR_name>-<hash>`, for example:
11+
When you create the object, the Machine Config Operator (MCO) creates a `MachineOSBuild` object and a builder pod. The process also creates transient objects, such as config maps, which are cleaned up after the build is complete. The `MachineOSBuild` object and the associated `builder-*` pod use the same naming scheme, `<MachineOSConfig_CR_name>-<hash>`, for example:
1712

1813
.Example `MachineOSBuild` object
1914
[source,terminal]
2015
----
21-
NAME PREPARED BUILDING SUCCEEDED INTERRUPTED FAILED
22-
layered-c8765e26ebc87e1e17a7d6e0a78e8bae False False True False False
16+
NAME PREPARED BUILDING SUCCEEDED INTERRUPTED FAILED
17+
layered-image-c8765e26ebc87e1e17a7d6e0a78e8bae False False True False False
2318
----
2419

2520
.Example builder pod
2621
[source,terminal]
2722
----
28-
NAME READY STATUS RESTARTS AGE
29-
build-layered-c8765e26ebc87e1e17a7d6e0a78e8bae 2/2 Running 0 11m
23+
NAME READY STATUS RESTARTS AGE
24+
build-layered-image-c8765e26ebc87e1e17a7d6e0a78e8bae 2/2 Running 0 11m
3025
----
3126

32-
When the build is complete, the MCO pushes the new custom layered image to your repository and rolled out to the nodes in the associated machine config pool. You can see the digested image pull spec for the new custom layered image in the `MachineOSBuild` object and `machine-os-builder` pod.
27+
You should not need to interact with these new objects or the `machine-os-builder` pod. However, you can use all of these resources for troubleshooting, if necessary.
28+
29+
When the build is complete, the MCO pushes the new custom layered image to your repository and rolls the image out to the nodes in the associated machine config pool. You can see the digested image pull spec for the new custom layered image in the `MachineOSConfig` object. This is now the active image pull spec for this `MachineOSConfig`.
30+
31+
.Example digested image pull spec
32+
[source,terminal]
33+
----
34+
apiVersion: machineconfiguration.openshift.io/v1
35+
kind: MachineOSConfig
36+
metadata:
37+
annotations:
38+
machineconfiguration.openshift.io/current-machine-os-build: layered-9a8f89455246fa0c42ecee6ff1fa1a45
39+
labels:
40+
machineconfiguration.openshift.io/createdByOnClusterBuildsHelper: ""
41+
name: layered-image
42+
# ...
43+
status:
44+
currentImagePullSpec: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/os-image@sha256:3c8fc667adcb432ce0c83581f16086afec08a961dd28fed69bb6bad6db0a0754
45+
----
3346

3447
[TIP]
3548
====
3649
You can test a `MachineOSBuild` object to make sure it builds correctly without rolling out the custom layered image to active nodes by using a custom machine config pool that contains non-production nodes. Alternatively, you can use a custom machine config pool that has no nodes. The `MachineOSBuild` object builds even if there are no nodes for the MCO to deploy the custom layered image onto.
3750
====
3851

39-
You should not need to interact with these new objects or the `machine-os-builder` pod. However, you can use all of these resources for troubleshooting, if necessary.
52+
You can apply a custom layered image to any machine config pool in your cluster, including the control plane, worker, or custom pools.
4053

41-
You need a separate `MachineOSConfig` CR for each machine config pool where you want to use a custom layered image.
54+
[NOTE]
55+
====
56+
For {sno} clusters, you can apply a custom layered image to the control plane node only.
57+
====
4258

4359
include::snippets//coreos-layering-configuring-on-pause.adoc[]
4460

45-
In the case of a build failure, for example due to network issues or an invalid secret, the MCO retries the build three additional times before the job fails. The MCO creates a different build pod for each build attempt. You can use the build pod logs to troubleshoot any build failures. However, the MCO automatically removes these build pods after a short period of time.
61+
In the case of a build failure, for example due to network issues or an invalid secret, the MCO retries the build three additional times before the job fails. The MCO creates a different build pod for each build attempt. You can use the build pod logs to troubleshoot any build failures. Note that the MCO automatically removes these build pods after a short period of time.
4662

4763
.Example failed `MachineOSBuild` object
4864
[source,terminal]
4965
----
50-
NAME PREPARED BUILDING SUCCEEDED INTERRUPTED FAILED
51-
layered-c8765e26ebc87e1e17a7d6e0a78e8bae False False False False True
66+
NAME PREPARED BUILDING SUCCEEDED INTERRUPTED FAILED AGE
67+
layered-image-c8765e26ebc87e1e17a7d6e0a78e8bae False False False False True 12m
5268
----
5369

5470
You can manually rebuild your custom layered image by either modifying your `MachineOSConfig` object or applying an annotation to the `MachineOSConfig` object. For more information, see "Rebuilding an on-cluster custom layered image".
@@ -59,221 +75,17 @@ You can modify an on-custom layered image as needed, to install additional packa
5975

6076
[discrete]
6177
[id="coreos-layering-configuring-on-limitations_{context}"]
62-
== On-cluster layering known limitations
78+
== {image-mode-os-on-caps} known limitations
6379

6480
Note the following limitations when working with the on-cluster layering feature:
6581

66-
* On-cluster layering is supported only for {product-title} clusters on the AMD64 architecture.
67-
* On-cluster layering is not supported on multi-architecture compute machines, or {sno} clusters.
82+
* {image-mode-os-on-caps} is not supported on multi-architecture compute machines.
83+
* Using multiple `MachineOSConfig` objects on the same machine config pool is not supported. You need a separate `MachineOSConfig` CR for each machine config pool where you want to use a distinct custom layered image.
6884
* If you scale up a machine set that uses a custom layered image, the nodes reboot two times. The first, when the node is initially created with the base image and a second time when the custom layered image is applied.
6985
* Node disruption policies are not supported on nodes with a custom layered image. As a result the following configuration changes cause a node reboot:
7086
** Modifying the configuration files in the `/var` or `/etc` directory
7187
** Adding or modifying a systemd service
7288
** Changing SSH keys
7389
** Removing mirroring rules from `ICSP`, `ITMS`, and `IDMS` objects
7490
** Changing the trusted CA, by updating the `user-ca-bundle` configmap in the `openshift-config` namespace
75-
* The images used in creating custom layered images take up space in your push registry. Always be aware of the free space in your registry and prune the images as needed. You can automatically remove an on-cluster custom layered image from the repository by deleting the MachineOSBuild object that created the image. Note that the credentials provided by the registry push secret must also grant permission to delete an image from the registry. For more information, see "Removing an on-cluster custom layered image".
76-
77-
.Prerequisites
78-
79-
* You have a copy of the pull secret in the `openshift-machine-config-operator` namespace that the MCO needs to pull the base operating system image.
80-
+
81-
For example, if you are using the global pull secret, you can run the following command:
82-
+
83-
[source,terminal]
84-
----
85-
$oc create secret docker-registry global-pull-secret-copy \
86-
--namespace "openshift-machine-config-operator" \
87-
--from-file=.dockerconfigjson=<(oc get secret/pull-secret -n openshift-config -o go-template='{{index .data ".dockerconfigjson" | base64decode}}')
88-
----
89-
// https://issues.redhat.com/browse/OCPBUGS-42013
90-
91-
// Not in 4.18; maybe in 4.19
92-
// If you are using the global pull secret, the MCO automatically creates a copy when you first create a `MachineOSconfig` object.
93-
94-
* You have the push secret of the registry that the MCO needs to push the new custom layered image to.
95-
96-
* You have a pull secret that your nodes need to pull the new custom layered image from your registry. This should be a different secret than the one used to push the image to the repository.
97-
98-
* You are familiar with how to configure a Containerfile. Instructions on how to create a Containerfile are beyond the scope of this documentation.
99-
100-
* Optional: You have a separate machine config pool for the nodes where you want to apply the custom layered image. One benefit to having a custom machine config pool for the nodes it that you can easily revert to the base image, if needed. For more information, see "Reverting an on-cluster layered node".
101-
102-
.Procedure
103-
104-
. Create a `MachineOSconfig` object:
105-
106-
.. Create a YAML file similar to the following:
107-
+
108-
[source,yaml]
109-
----
110-
apiVersion: machineconfiguration.openshift.io/v1 <1>
111-
kind: MachineOSConfig
112-
metadata:
113-
name: layered <2>
114-
spec:
115-
machineConfigPool:
116-
name: layered <3>
117-
containerFile: # <4>
118-
- containerfileArch: NoArch <5>
119-
content: |-
120-
FROM configs AS final
121-
RUN dnf install -y cowsay && \
122-
dnf clean all && \
123-
ostree container commit
124-
imageBuilder: # <6>
125-
imageBuilderType: Job
126-
baseImagePullSecret: # <7>
127-
name: global-pull-secret-copy
128-
renderedImagePushSpec: image-registry.openshift-image-registry.svc:5000/openshift/os-image:latest # <8>
129-
renderedImagePushSecret: # <9>
130-
name: builder-dockercfg-mtcl23
131-
----
132-
<1> Specifies the `machineconfiguration.openshift.io/v1` API that is required for `MachineConfig` CRs.
133-
<2> Specifies a name for the `MachineOSConfig` object. This name is used with other [image-mode-os-on-lower] resources. The examples in this documentation use the name `layered`.
134-
<3> Specifies the name of the machine config pool associated with the nodes where you want to deploy the custom layered image. The examples in this documentation use the `layered` machine config pool.
135-
<4> Specifies the Containerfile to configure the custom layered image.
136-
<5> Specifies the architecture this containerfile is to be built for: `ARM64`, `AMD64`, `PPC64LE`, `S390X`, or `NoArch`. The default is `NoArch`, which defines a Containerfile that can be applied to any architecture.
137-
<6> Specifies the name of the image builder to use. This must be `Job`, which is a reference to the `job` object that is managing the image build.
138-
<7> Optional: Specifies the name of the pull secret that the MCO needs to pull the base operating system image from the registry. By default, the global pull secret is used.
139-
<8> Specifies the image registry to push the newly-built custom layered image to. This can be any registry that your cluster has access to in the `host[:port][/namespace]/name` or `svc_name.namespace.svc[:port]/repository/name:<tag>` format. This example uses the internal {product-title} registry. You can specify a mirror registry if you cluster is properly configured to use a mirror registry.
140-
<9> Specifies the name of the push secret that the MCO needs to push the newly-built custom layered image to that registry.
141-
142-
.. Create the `MachineOSConfig` object:
143-
+
144-
[source,terminal]
145-
----
146-
$ oc create -f <file_name>.yaml
147-
----
148-
149-
. If necessary, when the `MachineOSBuild` object has been created and is in the `READY` state, modify the node spec for the nodes where you want to use the new custom layered image:
150-
+
151-
.. Check that the `MachineOSBuild` object is `READY`. When the `SUCCEEDED` value is `True`, the build is complete.
152-
+
153-
[source,terminal]
154-
----
155-
$ oc get machineosbuild
156-
----
157-
+
158-
.Example output showing that the `MachineOSBuild` object is ready
159-
[source,terminal]
160-
----
161-
NAME PREPARED BUILDING SUCCEEDED INTERRUPTED FAILED
162-
layered-ad5a3cad36303c363cf458ab0524e7c0-builder False False True False False
163-
----
164-
165-
.. Edit the nodes where you want to deploy the custom layered image by adding a label for the machine config pool you specified in the `MachineOSConfig` object:
166-
+
167-
[source,terminal]
168-
----
169-
$ oc label node <node_name> 'node-role.kubernetes.io/<mcp_name>='
170-
----
171-
+
172-
--
173-
where:
174-
175-
node-role.kubernetes.io/<mcp_name>=:: Specifies a node selector that identifies the nodes to deploy the custom layered image.
176-
--
177-
+
178-
When you save the changes, the MCO drains, cordons, and reboots the nodes. After the reboot, the node will be using the new custom layered image.
179-
180-
.Verification
181-
182-
. Verify that the new pods are ready by running the following command:
183-
+
184-
[source,terminal]
185-
----
186-
$ oc get pods -n openshift-machine-config-operator
187-
----
188-
+
189-
.Example output
190-
[source,terminal]
191-
----
192-
NAME READY STATUS RESTARTS AGE
193-
build-layered-ad5a3cad36303c363cf458ab0524e7c0-hxrws 2/2 Running 0 2m40s # <1>
194-
# ...
195-
machine-os-builder-6fb66cfb99-zcpvq 1/1 Running 0 2m42s # <2>
196-
----
197-
<1> This is the build pod where the custom layered image is building, named in the `build-<MachineOSConfig_CR_name>-<hash>` format.
198-
<2> This pod can be used for troubleshooting.
199-
200-
. Verify that the `MachineOSConfig` object contains a reference to the new custom layered image by running the following command:
201-
+
202-
[source,terminal]
203-
----
204-
$ oc get machineosbuilds
205-
----
206-
+
207-
.Example output
208-
[source,terminal]
209-
----
210-
NAME PREPARED BUILDING SUCCEEDED INTERRUPTED FAILED
211-
layered-ad5a3cad36303c363cf458ab0524e7c0 False True False False False <1>
212-
----
213-
<1> The `MachineOSBuild` is named in the `<MachineOSConfig_CR_name>-<hash>` format.
214-
215-
. Verify that the `MachineOSBuild` object contains a reference to the new custom layered image by running the following command:
216-
+
217-
[source,terminal]
218-
----
219-
$ oc describe machineosbuild <object_name>
220-
----
221-
+
222-
.Example output
223-
[source,yaml]
224-
----
225-
Name: layered-ad5a3cad36303c363cf458ab0524e7c0
226-
# ...
227-
API Version: machineconfiguration.openshift.io/v1
228-
Kind: MachineOSBuild
229-
# ...
230-
Spec:
231-
Config Generation: 1
232-
Desired Config:
233-
Name: rendered-layered-ad5a3cad36303c363cf458ab0524e7c0
234-
Machine OS Config:
235-
Name: layered
236-
Rendered Image Pushspec: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/os-images:layered-ad5a3cad36303c363cf458ab0524e7c0
237-
# ...
238-
Last Transition Time: 2025-02-12T19:21:28Z
239-
Message: Build Ready
240-
Reason: Ready
241-
Status: True
242-
Type: Succeeded
243-
Final Image Pullspec: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/os-images@sha256:312e48825e074b01a913deedd6de68abd44894ede50b2d14f99d722f13cda04b <1>
244-
----
245-
<1> Digested image pull spec for the new custom layered image.
246-
247-
. Verify that the appropriate nodes are using the new custom layered image:
248-
249-
.. Start a debug session as root for a control plane node:
250-
+
251-
[source,terminal]
252-
----
253-
$ oc debug node/<node_name>
254-
----
255-
256-
.. Set `/host` as the root directory within the debug shell:
257-
+
258-
[source,terminal]
259-
----
260-
sh-4.4# chroot /host
261-
----
262-
263-
.. Run the `rpm-ostree status` command to view that the custom layered image is in use:
264-
+
265-
[source,terminal]
266-
----
267-
sh-5.1# rpm-ostree status
268-
----
269-
+
270-
.Example output
271-
[source,terminal]
272-
----
273-
# ...
274-
Deployments:
275-
* ostree-unverified-registry:image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/os-images@sha256:312e48825e074b01a913deedd6de68abd44894ede50b2d14f99d722f13cda04b
276-
Digest: sha256:312e48825e074b01a913deedd6de68abd44894ede50b2d14f99d722f13cda04b <1>
277-
Version: 418.94.202502100215-0 (2025-02-12T19:20:44Z)
278-
----
279-
<1> Digested image pull spec for the new custom layered image.
91+
* The images used in creating custom layered images take up space in your push registry. Always be aware of the free space in your registry and prune the images as needed. You can automatically remove an on-cluster custom layered image from the repository by deleting the `MachineOSBuild` object that created the image. Note that the credentials provided by the registry push secret must also grant permission to delete an image from the registry. For more information, see "Removing an on-cluster custom layered image".

0 commit comments

Comments
 (0)