All Products
Search
Document Center

Container Compute Service:Use an image stored in an image repository to create an ACS workload

Last Updated:Aug 23, 2024

You can use an image stored in an image repository to create workloads in an Alibaba Cloud Container Compute Service (ACS) cluster. Before you start, you need to push a container image to an image repository. We recommend that you use Container Registry to build, distribute, and manage container images.

Prerequisites

  • An ACS cluster is created.

  • An image repository is created.

  • The ACS cluster is connected to the image repository.

    All images are pulled through the network plane of the ACS cluster. You can pull all images available in the virtual private cloud (VPC) of the ACS cluster.

    Note

    To images from a public address, make sure that the workload has Internet access. For more information, see Associate an exclusive EIP with a pod.

Specify an image

Use the console

Log on to the ACS console. Go to the Workloads page of the ACS cluster and create a Deployment, StatefulSet, Job, or CronJob. When you create the workload, you can use the following methods to select an image on the Container wizard page.

Method 1: Specify the name and tag of the image

image

You can manually specify the name and tag of an image. This method applies to all types of images.

Method 2: Select an existing image repository

image

Select an image when you create a workload

This method applies to all types of images:

If authentication is need to pull images, you must specify the Secret. You can specify the Secret when you create the workload or go to the Configurations > Secrets page of the ACS cluster to use an existing Secret.

Note

The endpoint of the image repository must be the same as that in the image address. For example, to pull registry.cn-hangzhou.aliyuncs.com/acsRepo/privateImage:latest, set the image repository to registry.cn-hangzhou.aliyuncs.com.

image.png

Use YAML

When you use YAML to create an ACS pod, you can set Kubernetes fields to specify the image information.

Templates: ACK provides a variety of Kubernetes YAML templates. You can create a pod for a Magic Cube application based on the following YAML template.

kind: Pod 
apiVersion: v1
metadata:
  name: acs-pod
spec:
  tolerations:
  - operator: "Exists"
  containers:
  - name: acs-container
    image: registry.cn-hangzhou.aliyuncs.com/acr-toolkit/cube:1.0
    imagePullPolicy: Always
    resources:
      limits:
        cpu: 1
        memory: "1Gi"
      requests:
        cpu: 1 
        memory: "1Gi" 
Important

To ensure the validity of the image, the imagePullPolicy parameter in the pod configuration file is forcefully set to Always.

References

For more information about container images, see What is Container Registry?

For more information about how to pull images without using Secrets, see Pull images from a Container Registry instance without using Secrets.