Halaman ini menunjukkan cara mengaktifkan operator Ray untuk Google Kubernetes Engine (GKE),
yang memungkinkan Anda menggunakan API KubeRay untuk menskalakan dan mengelola cluster Ray. Untuk mengetahui informasi selengkapnya tentang Ray dan KubeRay, lihat Ringkasan Ray di GKE.
Sebelum memulai
Sebelum memulai, pastikan Anda telah melakukan tugas berikut:
Jika ingin menggunakan Google Cloud CLI untuk tugas ini,
instal lalu
lakukan inisialisasi
gcloud CLI. Jika sebelumnya Anda telah menginstal gcloud CLI, dapatkan versi terbaru dengan menjalankan gcloud components update.
Mengaktifkan operator Ray untuk cluster
Anda dapat mengaktifkan operator Ray di cluster GKE Autopilot atau Standard baru atau yang sudah ada menggunakan Google Cloud CLI, konsol Google Cloud , atau Terraform.
Konsol
Buka halaman Google Kubernetes Engine di konsol Google Cloud .
VERSION: versi GKE, yang harus 1.30.0-gke.1747000 atau yang lebih baru. Anda juga dapat menggunakan opsi
--release-channel untuk memilih saluran rilis. Saluran rilis harus memiliki versi default 1.30.0-gke.1747000 atau yang lebih baru.
Anda dapat mengaktifkan operator Ray di cluster yang ada menggunakan perintah
gcloud container clusters update
dengan opsi --update-addons=RayOperator=ENABLED.
Terraform
Contoh Terraform berikut membuat dan mengonfigurasi cluster Standar:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-31 UTC."],[],[],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)."]]