Skip to content

Commit b5a32a3

Browse files
authored
Merge pull request #88409 from mburke5678/mco-on-cluster-layer-quick-start
[enterprise-4.16] MCO On Cluster Layering Quickstart Edits
2 parents 9ca4062 + 0fc2364 commit b5a32a3

File tree

2 files changed

+41
-55
lines changed

2 files changed

+41
-55
lines changed

modules/coreos-layering-configuring-on.adoc

Lines changed: 40 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,28 @@
66
[id="coreos-layering-configuring-on_{context}"]
77
= Using on-cluster layering to apply a custom layered image
88

9-
To apply a custom layered image to your cluster by using the on-cluster build process, make a `MachineOSConfig` custom resource that includes a Containerfile, a machine config pool reference, repository push and pull secrets, and other parameters as described in the prerequisites.
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:
1010

11-
When you create the object, the Machine Config Operator (MCO) creates a `MachineOSBuild` object and a `machine-os-builder` pod. The build process also creates transient objects, such as config maps, which are cleaned up after the build is complete.
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 `machine-os-builder` pod. The build process also creates transient objects, such as config maps, which are cleaned up after the build is complete.
1217

1318
When the build is complete, the MCO pushes the new custom layered image to your repository for use when deploying new nodes. You can see the digested image pull spec for the new custom layered image in the `MachineOSBuild` object and `machine-os-builder` pod.
1419

1520
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.
1621

1722
You need a separate `MachineOSConfig` CR for each machine config pool where you want to use a custom layered image.
1823

19-
:FeatureName: On-cluster image layering
20-
include::snippets/technology-preview.adoc[]
21-
2224
.Prerequisites
2325

24-
* You have enabled the `TechPreviewNoUpgrade` feature set by using the feature gates. For more information, see "Enabling features using feature gates".
26+
* You have a copy of the global pull secret in the `openshift-machine-config-operator` namespace that the MCO needs in order to pull the base operating system image.
2527
26-
* You have the pull secret in the `openshift-machine-config-operator` namespace that the MCO needs to pull the base operating system image.
28+
* You have a copy of the `etc-pki-entitlement` secret in the `openshift-machine-api` namespace.
2729
28-
* You have the push secret that the MCO needs to push the new custom layered image to your registry.
30+
* You have the push secret that the MCO needs in order to push the new custom layered image to your registry.
2931
3032
* 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.
3133
@@ -50,29 +52,32 @@ spec:
5052
name: <mcp_name> <1>
5153
buildInputs:
5254
containerFile: # <2>
53-
- containerfileArch: noarch
55+
- containerfileArch: noarch <3>
5456
content: |-
55-
FROM configs AS final
56-
RUN rpm-ostree install cowsay && \
57-
ostree container commit
58-
imageBuilder: # <3>
57+
FROM configs AS final <4>
58+
RUN dnf install -y cowsay && \
59+
dnf clean all && \
60+
ostree container commit
61+
imageBuilder: # <5>
5962
imageBuilderType: PodImageBuilder
60-
baseImagePullSecret: # <4>
63+
baseImagePullSecret: # <6>
6164
name: global-pull-secret-copy
62-
renderedImagePushspec: image-registry.openshift-image-registry.svc:5000/openshift/os-image:latest # <5>
63-
renderedImagePushSecret: # <6>
65+
renderedImagePushspec: image-registry.openshift-image-registry.svc:5000/openshift/os-image:latest # <7>
66+
renderedImagePushSecret: # <8>
6467
name: builder-dockercfg-7lzwl
65-
buildOutputs: # <7>
68+
buildOutputs: # <9>
6669
currentImagePullSecret:
6770
name: builder-dockercfg-7lzwl
6871
----
69-
<1> Specifies the name of the machine config pool associated with the nodes where you want to deploy the custom layered image.
70-
<2> Specifies the Containerfile to configure the custom layered image.
71-
<3> Specifies the name of the image builder to use. This must be `PodImageBuilder`.
72-
<4> Specifies the name of the pull secret that the MCO needs to pull the base operating system image from the registry.
73-
<5> Specifies the image registry to push the newly-built custom layered image to. This can be any registry that your cluster has access to. This example uses the internal {product-title} registry.
74-
<6> Specifies the name of the push secret that the MCO needs to push the newly-built custom layered image to that registry.
75-
<7> Specifies the secret required by the image registry that the nodes need to pull the newly-built custom layered image. This should be a different secret than the one used to push the image to your repository.
72+
<1> Specifies the machine config pool to deploy the custom layered image.
73+
<2> Specifies the Containerfile to configure the custom layered image. You can specify multiple build stages in the Containerfile.
74+
<3> Specifies the architecture of the image to be built. You must set this parameter to `noarch`.
75+
<4> Specifies the build stage as final. This field is required and applies to the last image in the build.
76+
<5> Specifies the name of the image builder to use. You must set this parameter to `PodImageBuilder`.
77+
<6> Specifies the name of the pull secret that the MCO needs in order to pull the base operating system image from the registry.
78+
<7> Specifies the image registry to push the newly-built custom layered image to. This can be any registry that your cluster has access to. This example uses the internal {product-title} registry.
79+
<8> Specifies the name of the push secret that the MCO needs in order to push the newly-built custom layered image to the registry.
80+
<9> Specifies the secret required by the image registry that the nodes need in order to pull the newly-built custom layered image. This should be a different secret than the one used to push the image to your repository.
7681

7782
.. Create the `MachineOSConfig` object:
7883
+
@@ -114,13 +119,14 @@ When you save the changes, the MCO drains, cordons, and reboots the nodes. After
114119

115120
.Verification
116121

117-
. Verify that the new pods are running by using the following command:
122+
. Verify that the new pods are ready by running the following command:
118123
+
119124
[source,terminal]
120125
----
121-
$ oc get pods -n <machineosbuilds_namespace>
126+
$ oc get pods -n openshift-machine-config-operator
122127
----
123128
+
129+
.Example output
124130
[source,terminal]
125131
----
126132
NAME READY STATUS RESTARTS AGE
@@ -131,48 +137,28 @@ machine-os-builder-6fb66cfb99-zcpvq 1/1 Runnin
131137
<1> This is the build pod where the custom layered image is building.
132138
<2> This pod can be used for troubleshooting.
133139

134-
. Verify that the `MachineOSConfig` object contains a reference to the new custom layered image:
140+
. Verify the current stage of your layered build by running the following command:
135141
+
136142
[source,terminal]
137143
----
138-
$ oc describe MachineOSConfig <object_name>
144+
$ oc get machineosbuilds
139145
----
140146
+
141-
[source,yaml]
147+
.Example output
148+
[source,terminal]
142149
----
143-
apiVersion: machineconfiguration.openshift.io/v1alpha1
144-
kind: MachineOSConfig
145-
metadata:
146-
name: layered
147-
spec:
148-
buildInputs:
149-
baseImagePullSecret:
150-
name: global-pull-secret-copy
151-
containerFile:
152-
- containerfileArch: noarch
153-
content: ""
154-
imageBuilder:
155-
imageBuilderType: PodImageBuilder
156-
renderedImagePushSecret:
157-
name: builder-dockercfg-ng82t-canonical
158-
renderedImagePushspec: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/os-image:latest
159-
buildOutputs:
160-
currentImagePullSecret:
161-
name: global-pull-secret-copy
162-
machineConfigPool:
163-
name: layered
164-
status:
165-
currentImagePullspec: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/os-image@sha256:f636fa5b504e92e6faa22ecd71a60b089dab72200f3d130c68dfec07148d11cd # <1>
150+
NAME PREPARED BUILDING SUCCEEDED INTERRUPTED FAILED
151+
layered-rendered-layered-ef6460613affe503b530047a11b28710-builder False True False False False
166152
----
167-
<1> Digested image pull spec for the new custom layered image.
168153

169-
. Verify that the `MachineOSBuild` object contains a reference to the new custom layered image.
154+
. Verify that the `MachineOSBuild` object contains a reference to the new custom layered image by running the following command:
170155
+
171156
[source,terminal]
172157
----
173158
$ oc describe machineosbuild <object_name>
174159
----
175160
+
161+
.Example output
176162
[source,yaml]
177163
----
178164
apiVersion: machineconfiguration.openshift.io/v1alpha1

modules/coreos-layering-configuring.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ metadata:
6565
spec:
6666
osImageURL: quay.io/my-registry/custom-image@sha256... <2>
6767
----
68-
<1> Specifies the machine config pool to apply the custom layered image.
68+
<1> Specifies the machine config pool to deploy the custom layered image.
6969
<2> Specifies the path to the custom layered image in the repository.
7070

7171
.. Create the `MachineConfig` object:

0 commit comments

Comments
 (0)