|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// post_installation_configuration/machine-configuration-tasks.adoc |
| 4 | + |
| 5 | +[id="set-the-default-max-container-root-partition-size-for-overlay-with-crio_{context}"] |
| 6 | += Setting the default maximum container root partition size for Overlay with CRI-O |
| 7 | + |
| 8 | +The root partition of each container shows all of the available disk space of the underlying host. Follow this guidance to set a maximum partition size for the root disk of all containers. |
| 9 | + |
| 10 | +To configure the maximum Overlay size, as well as other CRI-O options like the log level and PID limit, you can create the following `ContainerRuntimeConfig` custom resource definition (CRD): |
| 11 | + |
| 12 | +[source,yaml] |
| 13 | +---- |
| 14 | +apiVersion: machineconfiguration.openshift.io/v1 |
| 15 | +kind: ContainerRuntimeConfig |
| 16 | +metadata: |
| 17 | + name: overlay-size |
| 18 | +spec: |
| 19 | + machineConfigPoolSelector: |
| 20 | + matchLabels: |
| 21 | + custom-crio: overlay-size |
| 22 | + containerRuntimeConfig: |
| 23 | + pidsLimit: 2048 |
| 24 | + logLevel: debug |
| 25 | + overlaySize: 8G |
| 26 | +---- |
| 27 | + |
| 28 | +.Procedure |
| 29 | + |
| 30 | +. Create the configuration object: |
| 31 | ++ |
| 32 | +[source,terminal] |
| 33 | +---- |
| 34 | +$ oc apply -f overlaysize.yml |
| 35 | +---- |
| 36 | + |
| 37 | +. To apply the new CRI-O configuration to your worker nodes, edit the worker machine config pool: |
| 38 | ++ |
| 39 | +[source,terminal] |
| 40 | +---- |
| 41 | +$ oc edit machineconfigpool worker |
| 42 | +---- |
| 43 | + |
| 44 | +. Add the `custom-crio` label based on the `matchLabels` name you set in the `ContainerRuntimeConfig` CRD: |
| 45 | ++ |
| 46 | +[source,yaml] |
| 47 | +---- |
| 48 | +apiVersion: machineconfiguration.openshift.io/v1 |
| 49 | +kind: MachineConfigPool |
| 50 | +metadata: |
| 51 | + creationTimestamp: "2020-07-09T15:46:34Z" |
| 52 | + generation: 3 |
| 53 | + labels: |
| 54 | + custom-crio: overlay-size |
| 55 | + machineconfiguration.openshift.io/mco-built-in: "" |
| 56 | +---- |
| 57 | + |
| 58 | +. Save the changes, then view the machine configs: |
| 59 | ++ |
| 60 | +[source,terminal] |
| 61 | +---- |
| 62 | +$ oc get machineconfigs |
| 63 | +---- |
| 64 | ++ |
| 65 | +New `99-worker-generated-containerruntime` and `rendered-worker-xyz` objects are created: |
| 66 | ++ |
| 67 | +.Example output |
| 68 | +[source,terminal] |
| 69 | +---- |
| 70 | +99-worker-generated-containerruntime 4173030d89fbf4a7a0976d1665491a4d9a6e54f1 2.2.0 7m42s |
| 71 | +rendered-worker-xyz 4173030d89fbf4a7a0976d1665491a4d9a6e54f1 2.2.0 7m36s |
| 72 | +---- |
| 73 | + |
| 74 | +. After those objects are created, monitor the machine config pool for the changes to be applied: |
| 75 | ++ |
| 76 | +[source,terminal] |
| 77 | +---- |
| 78 | +$ oc get mcp worker |
| 79 | +---- |
| 80 | ++ |
| 81 | +The worker nodes show `UPDATING` as `True`, as well as the number of machines, the number updated, and other details: |
| 82 | ++ |
| 83 | +.Example output |
| 84 | +[source,terminal] |
| 85 | +---- |
| 86 | +NAME CONFIG UPDATED UPDATING DEGRADED MACHINECOUNT READYMACHINECOUNT UPDATEDMACHINECOUNT DEGRADEDMACHINECOUNT AGE |
| 87 | +worker rendered-worker-xyz False True False 3 2 2 0 20h |
| 88 | +---- |
| 89 | ++ |
| 90 | +When complete, the worker nodes transition back to `UPDATING` as `False`, and the `UPDATEDMACHINECOUNT` number matches the `MACHINECOUNT`: |
| 91 | ++ |
| 92 | +.Example output |
| 93 | +[source,terminal] |
| 94 | +---- |
| 95 | +NAME CONFIG UPDATED UPDATING DEGRADED MACHINECOUNT READYMACHINECOUNT UPDATEDMACHINECOUNT DEGRADEDMACHINECOUNT AGE |
| 96 | +worker rendered-worker-xyz True False False 3 3 3 0 20h |
| 97 | +---- |
| 98 | ++ |
| 99 | +Looking at a worker machine, you see that the new 8 GB max size configuration is applied to all of the workers: |
| 100 | ++ |
| 101 | +.Example output |
| 102 | +[source,terminal] |
| 103 | +---- |
| 104 | +head -n 7 /etc/containers/storage.conf |
| 105 | +[storage] |
| 106 | + driver = "overlay" |
| 107 | + runroot = "/var/run/containers/storage" |
| 108 | + graphroot = "/var/lib/containers/storage" |
| 109 | + [storage.options] |
| 110 | + additionalimagestores = [] |
| 111 | + size = "8G" |
| 112 | +---- |
| 113 | ++ |
| 114 | +Looking inside a container, you see that the root partition is now 8 GB: |
| 115 | ++ |
| 116 | +.Example output |
| 117 | +[source,terminal] |
| 118 | +---- |
| 119 | +~ $ df -h |
| 120 | +Filesystem Size Used Available Use% Mounted on |
| 121 | +overlay 8.0G 8.0K 8.0G 0% / |
| 122 | +---- |
0 commit comments