[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-31 (世界標準時間)。"],[],[],null,["# Enable the Ray operator on Google Kubernetes Engine (GKE)\n\n[Autopilot](/kubernetes-engine/docs/concepts/autopilot-overview) [Standard](/kubernetes-engine/docs/concepts/choose-cluster-mode)\n\n*** ** * ** ***\n\nThis page shows you how to enable the Ray operator for Google Kubernetes Engine (GKE),\nletting you use the KubeRay APIs to scale and manage Ray clusters. For more\ninformation on Ray and KubeRay, see\n[Ray on GKE overview](/kubernetes-engine/docs/add-on/ray-on-gke/concepts/overview).\n\nBefore you begin\n----------------\n\nBefore you start, make sure that you have performed the following tasks:\n\n- Enable the Google Kubernetes Engine API.\n[Enable Google Kubernetes Engine API](https://console.cloud.google.com/flows/enableapi?apiid=container.googleapis.com)\n- If you want to use the Google Cloud CLI for this task, [install](/sdk/docs/install) and then [initialize](/sdk/docs/initializing) the gcloud CLI. If you previously installed the gcloud CLI, get the latest version by running `gcloud components update`. **Note:** For existing gcloud CLI installations, make sure to set the `compute/region` [property](/sdk/docs/properties#setting_properties). If you use primarily zonal clusters, set the `compute/zone` instead. By setting a default location, you can avoid errors in the gcloud CLI like the following: `One of [--zone, --region] must be supplied: Please specify location`. You might need to specify the location in certain commands if the location of your cluster differs from the default that you set.\n\nEnable the Ray operator for a cluster\n-------------------------------------\n\nYou can enable the Ray operator on new or existing Autopilot or\nStandard GKE clusters using the Google Cloud CLI, the Google Cloud console,\nor Terraform. \n\n### Console\n\n1. Go to the **Google Kubernetes Engine** page in the Google Cloud console.\n\n [Go to Google Kubernetes Engine](https://console.cloud.google.com/kubernetes/list)\n2. Click add_box **Create** then in the Standard or Autopilot section, click **Configure**.\n\n3. For Standard, from the navigation pane, under **Cluster** , click **Features** . For Autopilot, click **Advanced Settings**.\n\n4. In the **AI and Machine Learning** section, select the **Enable Ray Operator**\n checkbox.\n\n5. Click **Create**.\n\n### gcloud\n\nCreate a cluster using the `--addons=RayOperator` option: \n\n gcloud container clusters create \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e \\\n --cluster-version=\u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e \\\n --addons=RayOperator\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name of the new cluster.\n- \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e: the GKE version, which must be 1.30.0-gke.1747000 or later. You can also use the `--release-channel` option to select a release channel. The release channel must have a default version of 1.30.0-gke.1747000 or later.\n\nYou can enable the Ray operator on an existing cluster by using the\n[`gcloud container clusters update`](/sdk/gcloud/reference/container/clusters/update)\ncommand with option `--update-addons=RayOperator=ENABLED`.\n\n### Terraform\n\nThe following Terraform example creates and configures a Standard\ncluster: \n\n resource \"google_container_cluster\" \"default\" {\n name = \"gke-standard-regional-ray-operator\"\n location = \"us-west1\"\n\n initial_node_count = 1\n\n release_channel {\n channel = \"RAPID\"\n }\n\n addons_config {\n ray_operator_config {\n enabled = true\n ray_cluster_logging_config {\n enabled = true\n }\n ray_cluster_monitoring_config {\n enabled = true\n }\n }\n }\n }\n\nTo learn more about using Terraform, see\n[Terraform support for GKE](/kubernetes-engine/docs/resources/use-terraform-gke).\n\nVersioning\n----------\n\nThe Ray Operator is available in the following GKE minor versions with a corresponding KubeRay version:\n\nVerify the Ray operator is enabled\n----------------------------------\n\nYou can verify that the Ray operator is enabled on an Autopilot or\nStandard GKE cluster using the gcloud CLI or\nthe Google Cloud console. \n\n### Console\n\n1. Go to the **Google Kubernetes Engine** page in the Google Cloud console.\n\n [Go to Google Kubernetes Engine](https://console.cloud.google.com/kubernetes/list)\n2. In the cluster list, click the name of the cluster that you want to\n verify.\n\n3. In the **Features** section, confirm that the **Ray Operator** checkbox is\n selected.\n\n### gcloud\n\nDescribe your cluster: \n\n gcloud container clusters describe \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e\n\nReplace \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e with the name of the cluster.\n\nThe output is similar to the following \n\n # Several lines omitted\n addonsConfig:\n rayOperatorConfig:\n enabled: true\n\nThis output indicates that the Ray operator is enabled for the cluster.\n\nWhat's next\n-----------\n\n- Learn about [Ray on Kubernetes](https://docs.ray.io/en/latest/cluster/kubernetes/index.html).\n- Learn how to [collect and view logs and metrics for Ray clusters](/kubernetes-engine/docs/add-on/ray-on-gke/how-to/collect-view-logs-metrics).\n- Explore the [KubeRay documentation](https://docs.ray.io/en/latest/cluster/kubernetes/getting-started.html)."]]