All Products
Search
Document Center

Container Service for Kubernetes:Deploy a Ray cluster on ACK

Last Updated:Oct 21, 2026

Ray is an open source framework for building scalable artificial intelligence (AI) and Python applications, and is widely used in machine learning. Deploy a Ray cluster on Container Service for Kubernetes (ACK) to run these applications.

Prerequisites

Deploy the Ray cluster

Create a RayCluster named demo-ray-cluster and check the deployment status.

  1. Create a ray-cluster.yaml file with the following content.

    Important

    The image (registry-cn-hangzhou.ack.aliyuncs.com/ack-demo/ray) used in the following sample YAML is for demonstration purposes only, and the Ray version in the sample image may be outdated. In production environments, replace the image based on your requirements, for example, with the latest image from the Ray open source community. For more information, see Shared responsibilities for Ray on ACK.

    Sample RayCluster YAML

    apiVersion: ray.io/v1
    kind: RayCluster
    metadata:
      name: demo-ray-cluster
      namespace: default
    spec:
      suspend: false
      headGroupSpec:
        rayStartParams:
          dashboard-host: 0.0.0.0
          num-cpus: "0"
        serviceType: ClusterIP
        template:
          spec:
            containers:
            - image: registry-cn-hangzhou.ack.aliyuncs.com/ack-demo/ray:2.56.1-py312
              imagePullPolicy: Always
              name: ray-head
              resources:
                limits:
                  cpu: "1"
                  memory: 2Gi
                requests:
                  cpu: "1"
                  memory: 2Gi
      workerGroupSpecs:
      - groupName: worker-group
        numOfHosts: 1
        rayStartParams: {}
        replicas: 1
        template:
          spec:
            containers:
            - image: registry-cn-hangzhou.ack.aliyuncs.com/ack-demo/ray:2.56.1-py312
              imagePullPolicy: Always
              name: ray-worker
              resources:
                limits:
                  cpu: "2"
                  memory: 4Gi
                requests:
                  cpu: "2"
                  memory: 4Gi
  2. Create the sample RayCluster resource.

    kubectl apply -f ray-cluster.yaml
  1. Check the deployment status of the RayCluster and its related resources.

    1. Check the deployment status of the RayCluster.

      kubectl get raycluster demo-ray-cluster

      Expected output:

      NAME               DESIRED WORKERS   AVAILABLE WORKERS   CPUS   MEMORY   GPUS   STATUS   AGE
      demo-ray-cluster   1                 1                   3      6Gi      0      ready    32s
    2. Check the Pods of the RayCluster.

      kubectl get pod

      Expected output:

      NAME                                         READY   STATUS    RESTARTS   AGE
      demo-ray-cluster-head-mdvzb                  1/1     Running   0          46s
      demo-ray-cluster-worker-group-worker-c6zvw   1/1     Running   0          46s
    3. Check the Services of the RayCluster.

      kubectl get svc

      Expected output:

      NAME                        TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                                         AGE
      demo-ray-cluster-head-svc   ClusterIP   None         <none>        10001/TCP,8265/TCP,6379/TCP,8080/TCP,8000/TCP   56s
      kubernetes                  ClusterIP   172.16.0.1   <none>        443/TCP                                         48d