All Products
Search
Document Center

Elastic Container Instance:Deploy a DataCache CRD

Last Updated:Apr 01, 2026

Pulling large datasets into ECI containers often causes slow pod startup. The DataCache CRD lets Kubernetes users pre-pull data into a cache so containers start with data already available. This topic describes how to deploy the DataCache CRD controller in a Kubernetes cluster using Helm (recommended) or a YAML file.

Billing

Cluster typeBilling
Container Service for Kubernetes (ACK) clusterThe DataCache CRD deploys on an existing Elastic Compute Service (ECS) node. No additional charges apply.
ACK Serverless clusterDeploying the DataCache CRD creates a pod with 0.25 vCPU and 0.5 GiB of memory. You are charged for this pod: Price = (0.25 × unit price of vCPUs + 0.5 × unit price of memory) × running duration. For pricing details, see Billing of elastic container instances.

Prerequisites

Before you begin, ensure that you have:

  • An AccessKey ID and AccessKey secret with permissions to call DataCache API operations. For details, see Create an AccessKey pair

    Important

    The Alibaba Cloud account or RAM user associated with the AccessKey pair must have permissions to call DataCache-related API operations.

  • The region ID of the cluster

Deploy using Helm (recommended)

Helm is the recommended deployment method. It handles dependency management and simplifies upgrades.

Helm 3.7.0 or later

  1. Connect to the Kubernetes cluster.

  2. Check your Helm version.

    helm version
  3. If your Helm version is 3.7.x, enable OCI registry support.

    export HELM_EXPERIMENTAL_OCI=1
    Important

    Helm 3.7.x requires this flag to pull charts from OCI-compatible registries. Helm 3.8.0 and later enable OCI support by default — skip this step if you are on 3.8.0 or later.

  4. Set the environment variables.

    export REPO="oci://eci-release-registry.cn-hangzhou.cr.aliyuncs.com/datacache/datacache-operator"
    export AK='<AccessKey ID>'
    export SK='<AccessKey secret>'
    export REGION='<Region ID>'
    Important

    The REPO value points to the Alibaba Cloud Container Registry hosting the DataCache operator chart. Do not change the region ID embedded in the URL.

  5. Deploy the DataCache CRD.

    helm install datacache-operator $REPO --set accessKey=$AK --set secretKey=$SK --set regionId=$REGION
  6. Verify the deployment.

    kubectl get pods -n datacache-controller

    The controller pod should be in Running state:

    NAME                                          READY   STATUS    RESTARTS   AGE
    aliyun-datacache-controller-xxxxxxxxx-xxxxx   1/1     Running   0          30s

Helm earlier than 3.7.0

  1. Connect to the Kubernetes cluster.

  2. Check your Helm version.

    helm version
  3. Install the Container Registry plugin for Helm. If you have access to GitHub, run:

    helm plugin install https://github.com/AliyunContainerService/helm-acr

    If your network connection to GitHub is unstable, use the Alibaba Cloud mirror instead:

    git clone https://github.com/AliyunContainerService/helm-acr.git
    sed -i 's/github.com/helm-acr-releases.oss-cn-hangzhou.aliyuncs.com/g' helm-acr/scripts/install_plugin.sh
    helm plugin install helm-acr
    Important

    The sed command replaces the GitHub download URL in the install script with an Alibaba Cloud mirror URL (helm-acr-releases.oss-cn-hangzhou.aliyuncs.com), which is more reliable on networks with restricted access to GitHub.

  4. Add the DataCache Helm repository.

    helm repo add datacache acr://eci-release-chart.cn-hangzhou.cr.aliyuncs.com/datacache/datacache-operator
    helm repo update
  5. Set the environment variables.

    export REPO="datacache/datacache-operator"
    export AK='<AccessKey ID>'
    export SK='<AccessKey secret>'
    export REGION='<Region ID>'
  6. Deploy the DataCache CRD.

    helm install datacache-operator $REPO --set accessKey=$AK --set secretKey=$SK --set regionId=$REGION
  7. Verify the deployment.

    kubectl get pods -n datacache-controller

    The controller pod should be in Running state:

    NAME                                          READY   STATUS    RESTARTS   AGE
    aliyun-datacache-controller-xxxxxxxxx-xxxxx   1/1     Running   0          30s

Deploy using a YAML file

  1. Connect to the Kubernetes cluster.

  2. Create a file named aliyun-datacache-controller.yaml with the following content. Replace the three placeholder values marked with *** in the template: the AccessKey ID (line 13), AccessKey secret (line 14), and region ID (line 211).

    apiVersion: v1
    kind: Namespace
    metadata:
      name: datacache-controller
    ---
    apiVersion: v1
    kind: Secret
    metadata:
      name: accesskey.eci.aliyun.com
      namespace: datacache-controller
    type: Opaque
    stringData:
      accessKey: ***            # Enter the AccessKey ID.
      secretKey: ***            # Enter the AccessKey secret.
    ---
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      name: datacaches.eci.aliyun.com
    spec:
      group: eci.aliyun.com
      scope: Cluster
      names:
        kind: DataCache
        plural: datacaches
        singular: datacache
        shortNames:
          - edc
        categories:
          - all
      versions:
        - name: v1alpha1
          served: true
          storage: true
          subresources:
            status: {}
          schema:
            openAPIV3Schema:
              type: object
              required:
                - spec
              properties:
                spec:
                  type: object
                  required:
                    - path
                    - dataSource
                  properties:
                    bucket:
                      type: string
                      default: default
                      description: the name of a bucket. The default name is default. The bucket named eci-system is reserved to store common caches of Elastic Container Instance and cannot be used as a value.
                    path:
                      type: string
                      description: the directory of the bucket.
                    dataSource:
                      type: object
                      description: the cache data source.
                      properties:
                        type:
                          type: string
                          description: the property of the cache data source. Valid values: NAS, OSS, URL, and SNAPSHOT.
                        options:
                          type: object
                          description: the options for a specific type of cache data source. For more information, see the DataCache documentation.
                          x-kubernetes-preserve-unknown-fields: true
                    size:
                      type: integer
                      default: 20
                      description: the size of the data cache. You must plan the size. Default value: 20 GiB, which is the minimum size of an elastic block storage (EBS).
                    retentionDays:
                      type: integer
                      description: the retention period of the data cache. By default, data caches never expire.
                    netConfig:
                      type: object
                      properties:
                        securityGroupId:
                          type: string
                          description: the ID of the security group.
                        vSwitchId:
                          type: string
                          description: the ID of the vSwitch.
                        eipInstanceId:
                          type: string
                          description: the ID of the elastic IP address (EIP). If no source network address translation (SNAT) entry is created for the vSwitch, you can bind an EIP to pull Internet data.
                        eipCreateParam:
                          type: object
                          description: the parameter that is used to create an EIP. You can specify EipInstanceId or EipCreateParam.
                          properties:
                            bandwidth:
                              type: integer
                              description: the public bandwidth. Unit: MB. Default value: 5.
                            commonBandwidthPackage:
                              type: string
                              description: the EIP bandwidth plan.
                            internetChargeType:
                              type: string
                              description: the billing method of the EIP.
                            publicIpAddressPoolId:
                              type: string
                              description: the IP address pool.
                            ISP:
                              type: string
                              description: the EIP line type.
                status:
                  type: object
                  properties:
                    status:
                      type: string
                    progress:
                      type: string
                    snapshotId:
                      type: string
                    dataCacheId:
                      type: string
          additionalPrinterColumns:
            - name: Age
              type: date
              jsonPath: .metadata.creationTimestamp
            - name: dataCacheId
              type: string
              jsonPath: .status.dataCacheId
            - name: Status
              type: string
              jsonPath: .status.status
            - name: Progress
              type: string
              jsonPath: .status.progress
            - name: Bucket
              type: string
              jsonPath: .spec.bucket
            - name: Path
              type: string
              jsonPath: .spec.path
    ---
    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: aliyun-datacache-controller
      namespace: datacache-controller
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata:
      name: aliyun-datacache-controller
      namespace: datacache-controller
    rules:
      - apiGroups:
          - "eci.aliyun.com"
        resources:
          - datacaches
          - datacaches/status
        verbs:
          - "*"
      - apiGroups:
          - ""
        resources:
          - events
        verbs:
          - create
          - patch
          - update
      - apiGroups:
          - ""
        resources:
          - configmaps
        verbs:
          - get
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      name: aliyun-datacache-controller
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: aliyun-datacache-controller
    subjects:
      - kind: ServiceAccount
        name: aliyun-datacache-controller
        namespace: datacache-controller
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: aliyun-datacache-controller
      namespace: datacache-controller
    spec:
      selector:
        matchLabels:
          app: aliyun-datacache-controller
      replicas: 1
      template:
        metadata:
          labels:
            app: aliyun-datacache-controller
        spec:
          serviceAccountName: aliyun-datacache-controller
          containers:
          - name: datacache-operator
            image: eci-release-registry.cn-hangzhou.cr.aliyuncs.com/datacache/datacache-operator:latest
            resources:
              limits:
                memory: "512Mi"
                cpu: "250m"
              requests:
                memory: "64Mi"
                cpu: "50m"
            env:
            - name: REGION_ID
              value: *** # Specify the actual region ID.
            - name: ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  name: accesskey.eci.aliyun.com
                  key: accessKey
            - name: SECRET_KEY
              valueFrom:
                secretKeyRef:
                  name: accesskey.eci.aliyun.com
                  key: secretKey
  3. Deploy the DataCache CRD.

    kubectl apply -f aliyun-datacache-controller.yaml
  4. Verify the deployment.

    kubectl get pods -n datacache-controller

    The controller pod should be in Running state:

    NAME                                          READY   STATUS    RESTARTS   AGE
    aliyun-datacache-controller-xxxxxxxxx-xxxxx   1/1     Running   0          30s