|
6 | 6 | [id="machine-config-pin-preload-images_{context}"]
|
7 | 7 | = Preloading and pinning and images
|
8 | 8 |
|
9 |
| -You can preload and pin images by using a a `PinnedImageSet` custom resource (CR). |
| 9 | +You can preload and pin images by using a `PinnedImageSet` custom resource (CR). The pinned image set defines the list of images to preload and the machine config pool that the images should be pinned to. |
10 | 10 |
|
| 11 | +The file is stored in the the `/etc/crio/crio.conf.d` directory under a name that is a concatenation of the name of the `PinnedImageSet` object and the UUID assigned to the object. |
| 12 | + |
| 13 | +.Procedure |
| 14 | + |
| 15 | +. Create a YAML file that defines the `PinnedImageSet` similar to the following example: |
| 16 | ++ |
| 17 | +[source,yaml] |
| 18 | +---- |
| 19 | +apiVersion: machineconfiguration.openshift.io/v1 |
| 20 | +kind: PinnedImageSet |
| 21 | +metadata: |
| 22 | + labels: |
| 23 | + machineconfiguration.openshift.io/role: worker <1> |
| 24 | + name: worker-pinned-images |
| 25 | +spec: |
| 26 | + pinnedImages: <2> |
| 27 | + - name: quay.io/openshifttest/busybox@sha256:0415f56ccc05526 |
| 28 | + - name: quay.io/openshifttest/alpine@sha256:be92b18a369e989a |
| 29 | +---- |
| 30 | +<1> Optional: A node selector to specify the machine config pool to pin the images to. If not specified, the images are pinned to all nodes in the cluster. |
| 31 | +<2> A list of one or more images to preload. |
| 32 | + |
| 33 | +.. Create the `PinnedImageSet` object by running the following command: |
| 34 | ++ |
| 35 | +[source,terminal] |
| 36 | +---- |
| 37 | +$ oc create -f <file_name>.yaml |
| 38 | +---- |
| 39 | + |
| 40 | +.Verification |
| 41 | + |
| 42 | +. Check that the pinned image set is reported in the machine config node object for the affected machine config pool by running the following command: |
| 43 | ++ |
| 44 | +[source,terminal] |
| 45 | +---- |
| 46 | +$ oc describe machineconfignode <machine_confignode_name> |
| 47 | +---- |
| 48 | ++ |
| 49 | +.Example command |
| 50 | +[source,terminal] |
| 51 | +---- |
| 52 | +$ oc describe machineconfignode ci-ln-25hlkvt-72292-jrs48-worker-a-2bdj |
| 53 | +---- |
| 54 | ++ |
| 55 | +.Example output |
| 56 | ++ |
| 57 | +[source,terminal] |
| 58 | +---- |
| 59 | +apiVersion: machineconfiguration.openshift.io/v1 |
| 60 | +kind: MachineConfigNode |
| 61 | +metadata: |
| 62 | + creationTimestamp: "2025-04-28T18:40:29Z" |
| 63 | + generation: 3 |
| 64 | + name: <machine_config_node_name> <1> |
| 65 | +# ... |
| 66 | +status |
| 67 | + pinnedImageSets: |
| 68 | + - desiredGeneration: 1 |
| 69 | + name: worker-pinned-images |
| 70 | +---- |
| 71 | ++ |
| 72 | +[NOTE] |
| 73 | +==== |
| 74 | +It can take a few moments for the object to be fully updated. |
| 75 | +==== |
| 76 | + |
| 77 | +. Check that the pinned image file is created and contains the correct images. The contents of the file appear similar to the following example: |
| 78 | + |
| 79 | +.. Start a debug session for a node by running the following command: |
| 80 | ++ |
| 81 | +[source,terminal] |
| 82 | +---- |
| 83 | +$ oc debug node/<node_name> |
| 84 | +---- |
| 85 | + |
| 86 | +.. Set `/host` as the root directory within the debug shell by running the following command: |
| 87 | ++ |
| 88 | +[source,terminal] |
| 89 | +---- |
| 90 | +sh-5.1# chroot /host |
| 91 | +---- |
| 92 | + |
| 93 | +.. Verify the contents of the pinned image file by running the following command: |
| 94 | ++ |
| 95 | +[source,terminal] |
| 96 | +---- |
| 97 | +$ cat /etc/crio/crio.conf.d/<pinned_image_set_name> |
| 98 | +---- |
| 99 | + |
| 100 | +.Example command |
| 101 | +[source,terminal] |
| 102 | +---- |
| 103 | +$ cat /etc/crio/crio.conf.d/worker-pinned-images-0b38991f-90d4-4d54-b111 |
| 104 | +---- |
| 105 | ++ |
| 106 | +.Example output |
| 107 | ++ |
| 108 | +[source,terminal] |
| 109 | +---- |
| 110 | +pinned_images=[ |
| 111 | + "quay.io/openshift-release-dev/ocp-release@sha256:...", |
| 112 | + "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...", |
| 113 | + "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...", |
| 114 | + ... |
| 115 | +] |
| 116 | +---- |
| 117 | + |
| 118 | +. Verify that the that pin and pull was successful by checking the `PinnedImageSet` object status: |
| 119 | ++ |
| 120 | ++ |
| 121 | +[source,terminal] |
| 122 | +---- |
| 123 | +$ oc describe PinnedImageSet worker-pinned-images |
| 124 | +---- |
11 | 125 |
|
0 commit comments