このコンテンツは選択した言語では利用できません。

Chapter 10. Cache images for faster workspace start


Use the Kubernetes Image Puller to pre-pull images and reduce workspace startup time.

10.1. Image caching for faster workspace start

To improve workspace start time, use the Image Puller, a community-supported OpenShift Dev Spaces-agnostic component that pre-pulls images for OpenShift clusters.

The Image Puller is an additional OpenShift deployment that creates a DaemonSet to pre-pull relevant OpenShift Dev Spaces workspace images on each node. These images are already available when a workspace starts, improving the workspace start time.

10.2. Install Image Puller on OpenShift using CLI

Install the Kubernetes Image Puller on OpenShift by using the oc CLI to cache images and reduce workspace startup time.

Important

If the Image Puller is installed with the oc CLI, it cannot be configured through the CheCluster Custom Resource.

Prerequisites

Procedure

  1. Gather a list of relevant container images to pull. See Section 10.7, “Retrieve the default list of images for Kubernetes Image Puller”.
  2. Define the memory requests and limits parameters to ensure pulled containers and the platform have enough memory to run.

    When defining the minimal value for CACHING_MEMORY_REQUEST or CACHING_MEMORY_LIMIT, consider the necessary amount of memory required to run each of the container images to pull.

    When defining the maximal value for CACHING_MEMORY_REQUEST or CACHING_MEMORY_LIMIT, consider the total memory allocated to the DaemonSet Pods in the cluster:

    (memory limit) * (number of images) * (number of nodes in the cluster)

    Pulling 5 images on 20 nodes, with a container memory limit of 20Mi requires 2000Mi of memory.

  3. Clone the Image Puller repository and get in the directory containing the OpenShift templates:

    git clone https://github.com/che-incubator/kubernetes-image-puller
    cd kubernetes-image-puller/deploy/openshift
  4. Configure the app.yaml, configmap.yaml, and serviceaccount.yaml OpenShift templates using the following parameters:

    Expand
    Table 10.1. Image Puller OpenShift templates parameters in app.yaml
    ValueUsageDefault

    DEPLOYMENT_NAME

    The value of DEPLOYMENT_NAME in the ConfigMap

    kubernetes-image-puller

    IMAGE

    Image used for the kubernetes-image-puller deployment

    registry.redhat.io/devspaces/imagepuller-rhel8

    IMAGE_TAG

    The image tag to pull

    latest

    SERVICEACCOUNT_NAME

    The name of the ServiceAccount created and used by the deployment

    kubernetes-image-puller

    Expand
    Table 10.2. Image Puller OpenShift templates parameters in configmap.yaml
    ValueUsageDefault

    CACHING_CPU_LIMIT

    The value of CACHING_CPU_LIMIT in the ConfigMap

    .2

    CACHING_CPU_REQUEST

    The value of CACHING_CPU_REQUEST in the ConfigMap

    .05

    CACHING_INTERVAL_HOURS

    The value of CACHING_INTERVAL_HOURS in the ConfigMap

    "1"

    CACHING_MEMORY_LIMIT

    The value of CACHING_MEMORY_LIMIT in the ConfigMap

    "20Mi"

    CACHING_MEMORY_REQUEST

    The value of CACHING_MEMORY_REQUEST in the ConfigMap

    "10Mi"

    DAEMONSET_NAME

    The value of DAEMONSET_NAME in the ConfigMap

    kubernetes-image-puller

    DEPLOYMENT_NAME

    The value of DEPLOYMENT_NAME in the ConfigMap

    kubernetes-image-puller

    IMAGES

    The value of IMAGES in the ConfigMap

    {}

    NAMESPACE

    The value of NAMESPACE in the ConfigMap

    k8s-image-puller

    NODE_SELECTOR

    The value of NODE_SELECTOR in the ConfigMap

    "{}"

    Expand
    Table 10.3. Image Puller OpenShift templates parameters in serviceaccount.yaml
    ValueUsageDefault

    SERVICEACCOUNT_NAME

    The name of the ServiceAccount created and used by the deployment

    kubernetes-image-puller

    KIP_IMAGE

    The image puller image to copy the sleep binary from

    registry.redhat.io/devspaces/imagepuller-rhel8:latest

  5. Create an OpenShift project to host the Image Puller:

    oc new-project <k8s-image-puller>
  6. Process and apply the templates to install the puller:

    oc process -f serviceaccount.yaml | oc apply -f -
    oc process -f configmap.yaml | oc apply -f -
    oc process -f app.yaml | oc apply -f -

Verification

  1. Verify the existence of a <kubernetes-image-puller> deployment and a <kubernetes-image-puller> DaemonSet. The DaemonSet needs to have a Pod for each node in the cluster:

    oc get deployment,daemonset,pod --namespace <k8s-image-puller>
  2. Verify the values of the <kubernetes-image-puller> ConfigMap.

    oc get configmap <kubernetes-image-puller> --output yaml

10.3. Install Image Puller on OpenShift by using the web console

Install the Kubernetes Image Puller Operator on OpenShift by using the OpenShift web console to cache images and reduce workspace startup time.

Prerequisites

Procedure

  1. Install the Kubernetes Image Puller Operator. See Installing from OperatorHub using the web console.
  2. Create a KubernetesImagePuller operand from the Kubernetes Image Puller Operator. See Creating applications from installed Operators.

Verification

  • In the OpenShift web console, go to Operators Installed Operators and verify that the Kubernetes Image Puller Operator status is Succeeded.

10.4. Configure Image Puller to pre-pull default OpenShift Dev Spaces images

Pre-pull default OpenShift Dev Spaces images with Kubernetes Image Puller to reduce workspace startup time. The Red Hat OpenShift Dev Spaces Operator controls the image list and updates it automatically on OpenShift Dev Spaces upgrade.

Prerequisites

  • You have an instance of OpenShift Dev Spaces installed and running on a Kubernetes cluster.
  • You have Image Puller installed on the Kubernetes cluster.
  • You have an active oc session with administrative permissions to the destination OpenShift cluster. See Getting started with the CLI.

Procedure

  1. Configure the Image Puller to pre-pull OpenShift Dev Spaces images.

    oc patch checluster/devspaces \
        --namespace openshift-devspaces \
        --type='merge' \
        --patch '{
                  "spec": {
                    "components": {
                      "imagePuller": {
                        "enable": true
                      }
                    }
                  }
                }'

Verification

  • Verify that the image puller is enabled:

    oc get checluster devspaces -n openshift-devspaces -o jsonpath='{.spec.components.imagePuller.enable}'

10.5. Configure Image Puller to pre-pull custom images

Pre-pull custom images with Kubernetes Image Puller so that workspaces using organization-specific container images start without waiting for large image downloads.

Prerequisites

  • You have an instance of OpenShift Dev Spaces installed and running on a Kubernetes cluster.
  • You have Image Puller installed on the Kubernetes cluster.
  • You have an active oc session with administrative permissions to the destination OpenShift cluster. See Getting started with the CLI.

Procedure

  1. Configure the Image Puller to pre-pull custom images.

    oc patch checluster/devspaces \
        --namespace openshift-devspaces \
        --type='merge' \
        --patch '{
                  "spec": {
                    "components": {
                      "imagePuller": {
                        "enable": true,
                        "spec": {
                          "images": "NAME-1=IMAGE-1;NAME-2=IMAGE-2"
                        }
                      }
                    }
                  }
                }'

    where:

    images
    The semicolon-separated list of images in name=image format.

Verification

  • Verify that the image puller is configured with the custom images:

    oc get checluster devspaces -n openshift-devspaces -o jsonpath='{.spec.components.imagePuller.spec.images}'

10.6. Configure Image Puller to pre-pull additional images

Pre-pull additional OpenShift Dev Spaces images with Kubernetes Image Puller to reduce workspace startup time by ensuring that required images are already cached on each node.

Prerequisites

  • You have an instance of OpenShift Dev Spaces installed and running on a Kubernetes cluster.
  • You have Image Puller installed on the Kubernetes cluster.
  • You have an active oc session with administrative permissions to the destination OpenShift cluster. See Getting started with the CLI.

Procedure

  1. Create k8s-image-puller namespace:

    oc create namespace k8s-image-puller
  2. Create KubernetesImagePuller Custom Resource:

    oc apply -f - <<EOF
    apiVersion: che.eclipse.org/v1alpha1
    kind: KubernetesImagePuller
    metadata:
      name: k8s-image-puller-images
      namespace: k8s-image-puller
    spec:
      images: "NAME-1=IMAGE-1;NAME-2=IMAGE-2"
    EOF

    where:

    images
    The semicolon-separated list of images in name=image format.

Verification

  • Verify that the image puller DaemonSet is running in the k8s-image-puller namespace:

    oc get daemonset -n k8s-image-puller

10.7. Retrieve the default list of images for Kubernetes Image Puller

Retrieve the default list of images used by Kubernetes Image Puller. This list helps administrators review and configure Image Puller to use only a subset of these images in advance.

Prerequisites

  • You have an instance of OpenShift Dev Spaces installed and running on a Kubernetes cluster.
  • You have an active oc session with administrative permissions to the destination OpenShift cluster. See Getting started with the CLI.

Procedure

  1. Determine the namespace where the OpenShift Dev Spaces Operator is deployed:

    OPERATOR_NAMESPACE=$(oc get pods -l app.kubernetes.io/component=devspaces-operator -o jsonpath={".items[0].metadata.namespace"} --all-namespaces)
  2. Determine the images that can be pre-pulled by the Image Puller:

    oc exec -n $OPERATOR_NAMESPACE deploy/devspaces-operator -- cat /tmp/external_images.txt
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

Red Hat ドキュメントについて

Legal Notice

Theme

© 2026 Red Hat
トップに戻る