Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Configurez les outils de ligne de commande pour vous connecter à Knative serving et interagir avec ce service.
Ces étapes supposent que vous utilisez un système d'exploitation Mac ou Linux. Si vous utilisez Microsoft Windows, vous devez ajuster les commandes.
Bien que vous puissiez choisir d'utiliser la consoleGoogle Cloud pour gérer la diffusion Knative, certaines tâches requièrent les outils de ligne de commande.
Pour installer et configurer les outils de ligne de commande pour Knative serving :
Si vous avez créé et utilisé un espace de noms autre que l'espace de noms default, vous pouvez le définir comme espace de noms par défaut dans Google Cloud CLI afin qu'il soit utilisé chaque fois que vous exécutez une commande :
gcloudconfigsetrun/namespaceNAMESPACE
Remplacez NAMESPACE par le nom de l'espace de noms que gcloud CLI doit utiliser par défaut.
Installer l'outil de ligne de commande kubectl :
gcloudcomponentsinstallkubectl
Facultatif : assurez-vous que tous les composants précédemment installés sont à jour :
gcloudcomponentsupdate
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/01 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/01 (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 are using Microsoft Windows, you need to adjust the commands.\n\n\u003cbr /\u003e\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 gke\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"]]