6.3.5. About configuring parallel container image pulls
To help control bandwidth issues, you can configure the number of workload images that can be pulled at the same time.
By default, the cluster pulls images in parallel, which allows multiple workloads to pull images at the same time. Pulling multiple images in parallel can improve workload start-up time because workloads can pull needed images without waiting for each other. However, pulling too many images at the same time can use excessive network bandwidth and cause latency issues throughout your cluster.
The default setting allows unlimited simultaneous image pulls. But, you can configure the maximum number of images that can be pulled in parallel. You can also force serial image pulling, which means that only one image can be pulled at a time.
To control the number of images that can be pulled simultaneously, use a kubelet configuration to set the maxParallelImagePulls to specify a limit. Additional image pulls above this limit are held until one of the current pulls is complete.
To force serial image pulls, use a kubelet configuration to set serializeImagePulls field to true.
6.3.5.1. Configuring parallel container image pulls 링크 복사링크가 클립보드에 복사되었습니다!
You can control the number of images that can be pulled by your workload simultaneously by using a kubelet configuration. You can set a maximum number of images that can be pulled or force workloads to pull images one at a time.
Prerequisites
- You have a running OpenShift Container Platform cluster.
- You are logged in to the cluster as a user with administrative privileges.
Procedure
Apply a custom label to the machine config pool where you want to configure parallel pulls by running a command similar to the following.
$ oc label machineconfigpool <mcp_name> parallel-pulls=setCreate a custom resource (CR) to configure parallel image pulling.
apiVersion: machineconfiguration.openshift.io/v1 kind: KubeletConfig metadata: name: parallel-image-pulls # ... spec: machineConfigPoolSelector: matchLabels: parallel-pulls: set kubeletConfig: serializeImagePulls: false maxParallelImagePulls: 3 # ...where:
serializeImagePulls-
Specifies whether parallel pulling is enabled for the nodes in the associated machine config pool. Set to
falseto enable parallel image pulls. Set totrueto force serial image pulling. The default isfalse. maxParallelImagePulls-
Specifies the maximum number of images that can be pulled in parallel. Enter a number or set to
nilto specify no limit. This field cannot be set ifSerializeImagePullsistrue. The default isnil.
Create the new machine config by running a command similar to the following:
$ oc create -f <file_name>.yaml
Verification
Check the machine configs to see that a new one was added by running the following command:
$ oc get MachineConfigNAME GENERATEDBYCONTROLLER IGNITIONVERSION AGE 00-master 70025364a114fc3067b2e82ce47fdb0149630e4b 3.5.0 133m 00-worker 70025364a114fc3067b2e82ce47fdb0149630e4b 3.5.0 133m # ... 99-parallel-generated-kubelet 70025364a114fc3067b2e82ce47fdb0149630e4b 3.5.0 15s # ... rendered-parallel-c634a80f644740974ceb40c054c79e50 70025364a114fc3067b2e82ce47fdb0149630e4b 3.5.0 10swhere:
99-parallel-generated-kubelet-
Specifies the new machine config. In this example, the machine config is for the
parallelcustom machine config pool. rendered-parallel-<sha_numnber>-
Specifies the new rendered machine config. In this example, the machine config is for the
parallelcustom machine config pool.
Check to see that the nodes in the
parallelmachine config pool are being updated by running the following command:$ oc get machineconfigpoolNAME CONFIG UPDATED UPDATING DEGRADED MACHINECOUNT READYMACHINECOUNT UPDATEDMACHINECOUNT DEGRADEDMACHINECOUNT AGE parallel rendered-parallel-3904f0e69130d125b3b5ef0e981b1ce1 False True False 1 0 0 0 65m master rendered-master-7536834c197384f3734c348c1d957c18 True False False 3 3 3 0 140m worker rendered-worker-c634a80f644740974ceb40c054c79e50 True False False 2 2 2 0 140mWhen the nodes are updated, verify that the parallel pull maximum was configured:
Open an
oc debugsession to a node by running a command similar to the following:$ oc debug node/<node_name>Set
/hostas the root directory within the debug shell by running the following command:sh-5.1# chroot /hostExamine the
kubelet.conffile by running the following command:sh-5.1# cat /etc/kubernetes/kubelet.conf | grep -i maxParallelImagePullsmaxParallelImagePulls: 3