Auf dieser Seite wird gezeigt, wie Sie den Ray-Operator für Google Kubernetes Engine (GKE) aktivieren, damit Sie die KubeRay APIs zum Skalieren und Verwalten von Ray-Clustern verwenden können. Weitere Informationen zu Ray und KubeRay finden Sie unter Ray in GKE – Übersicht.
Hinweise
Führen Sie die folgenden Schritte durch, bevor Sie beginnen:
Wenn Sie die Google Cloud CLI für diese Aufgabe verwenden möchten, müssen Sie die gcloud CLI installieren und dann initialisieren. Wenn Sie die gcloud CLI bereits installiert haben, rufen Sie die neueste Version mit gcloud components update ab.
Ray-Operator für einen Cluster aktivieren
Sie können den Ray-Operator in neuen oder vorhandenen Autopilot- oder Standard-GKE-Clustern mit der Google Cloud CLI, der Google Cloud Console oder Terraform aktivieren.
Console
Rufen Sie in der Google Cloud Console die Seite Google Kubernetes Engine auf.
VERSION: die GKE-Version, die mindestens 1.30.0-gke.1747000 sein muss. Sie können auch die Option --release-channel verwenden, um eine Release-Version auszuwählen. Die Release-Version muss die Standardversion 1.30.0-gke.1747000 oder höher haben.
Sie können den Ray-Operator in einem vorhandenen Cluster mit dem Befehl gcloud container clusters update und der Option --update-addons=RayOperator=ENABLED aktivieren.
Terraform
Im folgenden Terraform-Beispiel wird ein Standardcluster erstellt und konfiguriert:
resource "google_container_cluster" "ray-cluster" {
name = "gke-standard-regional-ray-operator"
location = "us-west1"
initial_node_count = 1
release_channel {
channel = "RAPID"
}
addons_config {
ray_operator_config {
enabled = true
ray_cluster_logging_config {
enabled = true
}
ray_cluster_monitoring_config {
enabled = true
}
}
}
# Set `deletion_protection` to `true` will ensure that one cannot
# accidentally delete this instance by use of Terraform.
deletion_protection = false
}
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2024-12-18 (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)."]]