Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Konfigurieren Sie die Befehlszeilentools, um eine Verbindung zu Knative Serving herzustellen und mit diesem zu interagieren.
Bei diesen Schritten wird davon ausgegangen, dass Sie ein Mac- oder Linux-Betriebssystem verwenden. Wenn Sie Microsoft Windows verwenden, müssen Sie die Befehle anpassen.
Sie können die Google Cloud Console auch verwenden, um Knative Serving zu verwalten. Es gibt jedoch einige Aufgaben, für die die Befehlszeilentools erforderlich sind.
So installieren und konfigurieren Sie die Befehlszeilentools für Knative Serving:
Ersetzen Sie ZONE_REGION durch die Zone oder Region Ihres Clusters.
Wenn Sie einen anderen Namespace als default erstellt haben und verwenden, können Sie diesen Namespace in Google Cloud CLI als Standard festlegen, damit er bei jeder Ausführung eines Befehls verwendet wird:
gcloudconfigsetrun/namespaceNAMESPACE
Ersetzen Sie NAMESPACE durch den Namen des Namespace, den die gcloud CLI standardmäßig verwenden soll.
Installieren Sie das kubectl-Befehlszeilentool:
gcloudcomponentsinstallkubectl
Optional: Prüfen Sie, ob alle zuvor installierten Komponenten aktuell sind:
[[["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: 2025-04-22 (UTC)."],[],[],null,["# Setting up the command-line environment\n\nConfigure the command-line tools to connect to and interact with Knative serving.\n\n\u003cbr /\u003e\n\nThese steps assume you are using a Mac or Linux operating system. If you\nare using Microsoft Windows, you need to adjust the commands.\n\nAlthough you can choose to use the\n[Google Cloud console](/kubernetes-engine/enterprise/knative-serving/docs/console) to manage\nKnative serving, there are some tasks that require the command-line\ntools.\n\nTo install and configure the command-line tools for Knative serving:\n\n1. [Install and initialize the Google Cloud CLI](/sdk/docs/install).\n\n2. Configure the Google Cloud CLI [defaults](/sdk/gcloud/reference/config#run):\n\n 1. Set your default Google Cloud project:\n\n gcloud config set project \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the ID of your Google Cloud project.\n 2. Set the\n [target platform](/sdk/gcloud/reference/run/deploy#--platform):\n\n gcloud config set run/platform kubernetes\n\n 3. Set the location of your cluster:\n\n gcloud config set run/cluster_location \u003cvar translate=\"no\"\u003eZONE_REGION\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eZONE_REGION\u003c/var\u003e with the\n [zone or region](/compute/docs/regions-zones#available)\n of your cluster.\n 4. If you created and use a new namespace other than the `default` namespace,\n you can set that namespace as the default in Google Cloud CLI so that it's\n used each time you run a command:\n\n gcloud config set run/namespace \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e with the name of the namespace that you want\n the gcloud CLI tool to use by default.\n3. Install the `kubectl` command-line tool:\n\n gcloud components install kubectl\n\n4. Optional: Ensure that all previously installed components are up-to-date:\n\n gcloud components update"]]