此内容没有您所选择的语言版本。
Chapter 8. Caching images for faster workspace start
To improve the start time performance of CodeReady Workspaces workspaces, use the Image Puller, a CodeReady Workspaces-agnostic component that can be used to pre-pull images for OpenShift clusters. The Image Puller is an additional OpenShift deployment which creates a DaemonSet that can be configured to pre-pull relevant CodeReady Workspaces workspace images on each node. These images would already be available when a CodeReady Workspaces workspace starts, therefore improving the workspace start time.
The Image Puller provides the following parameters for configuration.
Parameter | Usage | Default |
---|---|---|
| DaemonSets health checks interval in hours |
|
| The memory request for each cached image when the puller is running. See Section 8.2, “Defining the memory parameters for the Image Puller”. |
|
| The memory limit for each cached image when the puller is running. See Section 8.2, “Defining the memory parameters for the Image Puller”. |
|
| The processor request for each cached image when the puller is running |
|
| The processor limit for each cached image when the puller is running |
|
| Name of DaemonSet to create |
|
| Name of the Deployment to create |
|
| OpenShift project containing DaemonSet to create |
|
|
Semicolon separated list of images to pull, in the format | |
| Node selector to apply to the Pods created by the DaemonSet |
|
| Affinity applied to pods created by the DaemonSet |
|
|
List of image pull secrets, in the format |
|
Additional resources
- Section 8.1, “Defining the list of images to pull”
- Section 8.2, “Defining the memory parameters for the Image Puller”.
- Section 8.3, “Installing Image Puller using the CodeReady Workspaces Operator”
- Section 8.4, “Installing Image Puller on OpenShift 4 using OperatorHub”
- Section 8.5, “Installing Image Puller on OpenShift using OpenShift templates”
- Kubernetes Image Puller source code repository
8.1. Defining the list of images to pull 复制链接链接已复制到粘贴板!
The Image Puller can pre-pull most images, including scratch images such as che-machine-exec
. However, images that mount volumes in the Dockerfile, such as traefik
, are not supported for pre-pulling on OpenShift 3.11.
Pre-pulling images involved in workspace startup will reduce workspace start times. For example:
- Che-Theia
- broker images
- plug-in sidecar images
Prerequisites
-
The
curl
tool is available. See curl homepage. -
The
jq
tool is available. See jq homepage. -
The
yq
tool is available. See yq homepage.
Procedure
Gather a list of relevant container images for the OpenShift platform:
Example 8.1. Getting the list of all images for CodeReady Workspaces 2.12
curl -sSLo- https://raw.githubusercontent.com/redhat-developer/codeready-workspaces-images/crw-2.12-rhel-8/codeready-workspaces-operator-metadata-generated/manifests/codeready-workspaces.csv.yaml \ | yq -r '.spec.relatedImages[]'
$ curl -sSLo- https://raw.githubusercontent.com/redhat-developer/codeready-workspaces-images/crw-2.12-rhel-8/codeready-workspaces-operator-metadata-generated/manifests/codeready-workspaces.csv.yaml \ | yq -r '.spec.relatedImages[]'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retain the images involved on the workspace startup phase:
-
eap
-
machineexec
-
mongodb
-
pluginbroker
-
plugin-
-
stacks
-
theia
-
ubi-minimal
-
Exclude from the list the container images not supported by the target platform.
For AMD64 and Intel 64 (x86_64), exclude
openj9
images.Example 8.2. Image list for AMD64 and Intel 64 (x86_64), excluding
openj9
imagesCopy to Clipboard Copied! Toggle word wrap Toggle overflow For IBM Z and IBM Power Systems, use
openj9
version forjava8
andjava11
, and excludedotnet
.Example 8.3. Image list for IBM Z and IBM Power Systems: using
openj9
version forjava8
andjava11
, and excludingdotnet
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Determine images from the list for pre-pulling.
For faster workspace startup times, consider pre-pulling the workspace-related images:
-
theia-rhel8
-
theia-endpoint-rhel8
-
pluginbroker-artifacts-rhel8
-
pluginbroker-metadata-rhel8
-
stacks-*-rhel8
plugin-*-rhel8
- The list of stacks images: Container images - Stacks
- The list of plug-in images: Container images - Plug-ins
-
Additional resources
8.2. Defining the memory parameters for the Image Puller 复制链接链接已复制到粘贴板!
Define the memory requests and limits parameters to ensure pulled containers and the platform have enough memory to run.
Prerequisites
Procedure
-
To define the minimal value for
CACHING_MEMORY_REQUEST
orCACHING_MEMORY_LIMIT
, consider the necessary amount of memory required to run each of the container images to pull. To define the maximal value for
CACHING_MEMORY_REQUEST
orCACHING_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)
(memory limit) * (number of images) * (number of nodes in the cluster)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Pulling 5 images on 20 nodes, with a container memory limit of
20Mi
requires2000Mi
of memory.
This section describes how to use the CodeReady Workspaces Operator to install the Image Puller, which is a community-supported feature in the technology preview state.
Prerequisites
- Section 8.1, “Defining the list of images to pull”
- Section 8.2, “Defining the memory parameters for the Image Puller”
- Operator Lifecycle Manager and OperatorHub are available on the OpenShift instance. OpenShift provides them starting with version 4.2.
- The CodeReady Workspaces Operator is available. See Installing CodeReady Workspaces on OpenShift 4 using OperatorHub
Procedure
Enable Image Puller in the
CheCluster
Custom Resource by setting.spec.imagePuller.enable
totrue
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure Image Puller in the
CheCluster
Custom Resource:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
To use the supported Image Puller, install it separately from the KubernetesImagePuller Operator. Red Hat official build benefits from extra testing and validation provided by Red Hat.
Enabling the use of KubernetesImagePuller in Operator Hub during CodeReady Workspaces installation, sets the Community supported version for use.
Default images
-
The CodeReady Workspaces Operator populates the
.spec.imagePuller.spec.images
field with default images used for workspace startup (Theia images, plugin broker images, sidecar plugin images), provided that no images were added to this field before creating theCheCluster
Custom Resource. The CodeReady Workspaces Operator updates the default images in the.spec.imagePuller.spec.images
field after every rollout update of CodeReady Workspaces. However, if images were added to the.spec.imagePuller.spec.images
field before creating theCheCluster
Custom Resource, the CodeReady Workspaces Operator will not add default images. -
If user-provided images are added to the
.spec.imagePuller.spec.images
field after creating theCheCluster
Custom Resource, the CodeReady Workspaces Operator will still update default images on subsequent CodeReady Workspaces rollout updates. Non-default images remain unchanged in the.spec.imagePuller.spec.images
field after rollout updates.
Verification
-
OpenShift creates a
kubernetes-image-puller-operator
Subscription. The
eclipse-che namespace
contains acommunity supported Kubernetes Image Puller Operator
ClusterServiceVersion
:oc get clusterserviceversions
$ oc get clusterserviceversions
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
eclipse-che namespace
contains these deployments:kubernetes-image-puller
andkubernetes-image-puller-operator
.oc get deployments
$ oc get deployments
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The community supported Kubernetes Image Puller Operator creates a
KubernetesImagePuller
Custom Resource:oc get kubernetesimagepullers
$ oc get kubernetesimagepullers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Uninstalling Image Puller using CodeReady Workspaces Operator
-
Edit the
CheCluster
Custom Resource and set.spec.imagePuller.enable
tofalse
. -
Edit the
CheCluster
Custom Resource and set the.spec.imagePuller.spec
to configure the optional Image Puller parameters for the CodeReady Workspaces Operator.
This procedure describes how to install the community supported Kubernetes Image Puller Operator on OpenShift 4 using the Operator.
Prerequisites
- An administrator account on a running instance of OpenShift 4.
- Section 8.1, “Defining the list of images to pull”
- Section 8.2, “Defining the memory parameters for the Image Puller”.
Procedure
-
To create an OpenShift project <kubernetes-image-puller> to host the Image Puller, open the OpenShift web console, navigate to the Home
Projects section and click . Specify the project details:
- Name: <kubernetes-image-puller>
- Display Name: <Image Puller>
- Description: <Kubernetes Image Puller>
-
Navigate to
. -
Use the
community supported Kubernetes Image Puller Operator
. Click the . box to search for -
Read the description of the Operator. Click
. - Select <kubernetes-image-puller>. Click . for the . In the drop-down find the OpenShift project
-
Wait for the community supported Kubernetes Image Puller Operator to install. Click the
. -
In a redirected window with a YAML editor, make modifications to the
KubernetesImagePuller
Custom Resource and click . - Navigate to the <kubernetes-image-puller> OpenShift project. Verify that the Image Puller is available. and menu in the
This procedure describes how to install the Kubernetes Image Puller on OpenShift using OpenShift templates.
Prerequisites
- A running OpenShift cluster.
-
The
oc
tool is available. - Section 8.1, “Defining the list of images to pull”.
- Section 8.2, “Defining the memory parameters for the Image Puller”.
Procedure
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
$ git clone https://github.com/che-incubator/kubernetes-image-puller $ cd kubernetes-image-puller/deploy/openshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the
app.yaml
,configmap.yaml
andserviceaccount.yaml
OpenShift templates using following parameters:Expand Table 8.2. Image Puller OpenShift templates parameters in app.yaml Value Usage Default DEPLOYMENT_NAME
The value of
DEPLOYMENT_NAME
in the ConfigMapkubernetes-image-puller
IMAGE
Image used for the
kubernetes-image-puller
deploymentregistry.redhat.io/codeready-workspaces/imagepuller-rhel8:2.12
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 8.3. Image Puller OpenShift templates parameters in configmap.yaml Value Usage Default 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 ConfigMapkubernetes-image-puller
DEPLOYMENT_NAME
The value of
DEPLOYMENT_NAME
in the ConfigMapkubernetes-image-puller
IMAGES
The value of
IMAGES
in the ConfigMap'che_workspace_plugin_broker_artifacts=registry.redhat.io/codeready-workspaces/pluginbroker-artifacts-rhel8@sha256:3436bacdc249e8dcc289b67e89340bdc2c5b6694304fe369af751f684a140d60;che_workspace_plugin_broker_metadata=registry.redhat.io/codeready-workspaces/pluginbroker-metadata-rhel8@sha256:e709e89bd1ab1612baad039ad6b824b027a070ff0a37be3395202faa55518e09;codeready_workspaces_machineexec_plugin_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/machineexec-rhel8@sha256:93dc77a7f33171b36dbc112e7e732da4044c4c75a48b7a25907521c529170c0c;codeready_workspaces_plugin_java11_devfile_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/plugin-java11-rhel8@sha256:f06f983d5e49a1ab05b9de54e449b2033688e7a38a6c57550f2ed87b3bef3fe2;codeready_workspaces_plugin_java11_plugin_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/plugin-java11-rhel8@sha256:f06f983d5e49a1ab05b9de54e449b2033688e7a38a6c57550f2ed87b3bef3fe2;codeready_workspaces_plugin_java8_devfile_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/plugin-java8-rhel8@sha256:c451114be8be1ff012a85eae983d85216d0171dfc1376df1c410f54af0226bc2;codeready_workspaces_plugin_java8_plugin_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/plugin-java8-rhel8@sha256:c451114be8be1ff012a85eae983d85216d0171dfc1376df1c410f54af0226bc2;codeready_workspaces_plugin_kubernetes_plugin_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/plugin-kubernetes-rhel8@sha256:3e43ffa6757980fb0f092798b76d6bbfa63768c72d2f071b666f6401b6c0df5c;codeready_workspaces_plugin_openshift_plugin_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/plugin-openshift-rhel8@sha256:55e67c70b3b04e045230bf553e2394920d088027aad6eb5ce0a21abede138af5;codeready_workspaces_stacks_cpp_devfile_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/stacks-cpp-rhel8@sha256:5ae3c3fcef5050ca30126d55229fe3334e887c658d6e5fbe9ef6aa8339dfc89e;codeready_workspaces_stacks_cpp_plugin_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/stacks-cpp-rhel8@sha256:5ae3c3fcef5050ca30126d55229fe3334e887c658d6e5fbe9ef6aa8339dfc89e;codeready_workspaces_stacks_dotnet_devfile_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/stacks-dotnet-rhel8@sha256:68875b794b80d9590fceff2e35eaa8f0ac47cd9e8f183f54652a1d1703024dd8;codeready_workspaces_stacks_dotnet_plugin_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/stacks-dotnet-rhel8@sha256:68875b794b80d9590fceff2e35eaa8f0ac47cd9e8f183f54652a1d1703024dd8;codeready_workspaces_stacks_golang_devfile_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/stacks-golang-rhel8@sha256:a007380852029dcb01f2a00956f4e2b26c9c53d2063eca92d41d56fff4e83a27;codeready_workspaces_stacks_golang_plugin_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/stacks-golang-rhel8@sha256:a007380852029dcb01f2a00956f4e2b26c9c53d2063eca92d41d56fff4e83a27;codeready_workspaces_stacks_php_devfile_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/stacks-php-rhel8@sha256:193b9775d58e1f7d9a45607b23bbfea4cfcba53356872da3e28de3ee9a8254e5;codeready_workspaces_stacks_php_plugin_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/stacks-php-rhel8@sha256:193b9775d58e1f7d9a45607b23bbfea4cfcba53356872da3e28de3ee9a8254e5;codeready_workspaces_theia_endpoint_plugin_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/theia-endpoint-rhel8@sha256:2eb5fd69e08e3a1a8f557fe1d41170ee9dac89d15c5947aabc477d4e2107a9ea;codeready_workspaces_theia_plugin_registry_image_gixdcmqk=registry.redhat.io/codeready-workspaces/theia-rhel8@sha256:7c1fcf0a972e2905a0758d53e2155534643d0fbcbb688d57b54f05bafe323582;jboss_eap_7_eap74_openjdk8_openshift_rhel7_devfile_registry_image_g4xdilrqbi______=registry.redhat.io/jboss-eap-7/eap74-openjdk8-openshift-rhel7@sha256:b4a113c4d4972d142a3c350e2006a2b297dc883f8ddb29a88db19c892358632d;jboss_eap_7_eap_xp3_openjdk11_openshift_devfile_registry_image_gmxdaljzbi______=registry.redhat.io/jboss-eap-7/eap-xp3-openjdk11-openshift-rhel8@sha256:3875b2ee2826a6d8134aa3b80ac0c8b5ebc4a7f718335d76dfc3461b79f93d19;pvc_jobs=registry.redhat.io/ubi8/ubi-minimal@sha256:54ef2173bba7384dc7609e8affbae1c36f8a3ec137cacc0866116d65dd4b9afe;rhscl_mongodb_36_rhel7_devfile_registry_image_gewtkmak=registry.redhat.io/rhscl/mongodb-36-rhel7@sha256:9f799d356d7d2e442bde9d401b720600fd9059a3d8eefea6f3b2ffa721c0dc73;'
NAMESPACE
The value of
NAMESPACE
in the ConfigMapk8s-image-puller
NODE_SELECTOR
The value of
NODE_SELECTOR
in the ConfigMap"{}"
Expand Table 8.4. Image Puller OpenShift templates parameters in serviceaccount.yaml Value Usage Default SERVICEACCOUNT_NAME
The name of the ServiceAccount created and used by the deployment
kubernetes-image-puller
Create an OpenShift project to host the Image Puller:
oc new-project <k8s-image-puller>
$ oc new-project <k8s-image-puller>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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 -
$ oc process -f serviceaccount.yaml | oc apply -f - $ oc process -f configmap.yaml | oc apply -f - $ oc process -f app.yaml | oc apply -f -
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification steps
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>
$ oc get deployment,daemonset,pod --namespace <k8s-image-puller>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the values of the <kubernetes-image-puller>
ConfigMap
.oc get configmap <kubernetes-image-puller> --output yaml
$ oc get configmap <kubernetes-image-puller> --output yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow