Image download optimization
After a new image was uploaded to the target registry, it is not automatically downloaded to all compute nodes on the Cloud Pak for Data cluster. You can use the following Job JSON file to prepull the new image to each compute node.
To download the new image to all compute nodes on the cluster:
-
Create a Job JSON file based on the following content:
{ "kind": "Job", "apiVersion": "batch/v1", "metadata": { "name": "REPLACE_WITH_IMAGE_NAME-pull", "labels": { "app": "imagePrepull", "run": "REPLACE_WITH_IMAGE_NAME" } }, "spec": { "parallelism": 20, "completions": 20, "template": { "metadata": { "labels": { "app": "imagePrepull", "run": "REPLACE_WITH_IMAGE_NAME" } }, "spec": { "containers": [ { "name": "jupyter-custom-container", "image": "REPLACE_BY_FULL_NAME_OF_YOUR_IMAGE", "command": [ "echo", "Image preloaded" ], "resources": {}, "terminationMessagePath": "/dev/termination-log", "terminationMessagePolicy": "File", "imagePullPolicy": "Always" } ], "restartPolicy": "OnFailure", "affinity": { "nodeAffinity": { "requiredDuringSchedulingIgnoredDuringExecution": { "nodeSelectorTerms": [ { "matchExpressions": [ { "key": "kubernetes.io/arch", "operator": "In", "values": [ "REPLACE_WITH_ARCHITECTURE" ] } ] } ] } }, "podAntiAffinity": { "requiredDuringSchedulingIgnoredDuringExecution": [ { "labelSelector": { "matchExpressions": [ { "key": "run", "operator": "In", "values": [ "REPLACE_WITH_IMAGE_NAME" ] } ] }, "topologyKey": "kubernetes.io/hostname" } ] } } } } } }
Insert the following values in the sample JSON:
- REPLACE_WITH_IMAGE_NAME: myimage
- REPLACE_BY_FULL_NAME_OF_YOUR_IMAGE: registry/myimage:0.1
- REPLACE_WITH_ARCHITECTURE: amd64 or ppc64le
-
Execute the job:
oc create -f prepull.json
-
Verify the state of the job pods:
oc get pods | grep -i REPLACE_WITH_IMAGE_NAME-pull
If all the listed pods are in
Completed
state, the prepull finished successfully.
Parent topic: Registering the custom image