Utiliser les fichiers kubeconfig dans Cloud Code pour VS Code
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Les fichiers kubeconfig sont des fichiers de configuration Kubernetes qui organisent l'accès au cluster, les utilisateurs et les contextes. Cette page explique comment ajouter, supprimer et basculer entre différents fichiers kubeconfig dans Cloud Code.
Par défaut, le plug-in Cloud Code utilise le fichier kubeconfig par défaut (situé dans le répertoire $HOME/.kube) pour récupérer les ressources Kubernetes et exécuter des commandes. Toutefois, d'autres fichiers kubeconfig peuvent être configurés.
Ajouter des fichiers kubeconfig supplémentaires
Pour ajouter des fichiers kubeconfig supplémentaires:
Ouvrez la palette de commandes (appuyez sur Ctrl/Cmd+Shift+P ou cliquez sur Affichage > Palette de commandes), puis exécutez Cloud Code: Switch kubeconfig (Cloud Code : Modifier le kubeconfig).
Cliquez sur + Load kubeconfig (+ Charger kubeconfig), puis accédez à l'emplacement du fichier kubeconfig que vous souhaitez ajouter.
Sélectionnez le fichier kubeconfig que vous souhaitez ajouter, puis cliquez sur Add KubeConfig Path (Ajouter un chemin d'accès au fichier kubeconfig).
Lorsque vous y êtes invité, attribuez un nom au nouveau fichier kubeconfig.
Appuyez sur Enter pour confirmer.
Supprimer des fichiers kubeconfig
Pour supprimer des fichiers kubeconfig:
Ouvrez la palette de commandes (appuyez sur Ctrl/Cmd+Shift+P ou cliquez sur Afficher > Palette de commandes), puis exécutez Cloud Code: Remove KubeConfig from Kubernetes Explorer (Cloud Code : Supprimer KubeConfig de Kubernetes Explorer).
Cochez la case à côté du kubeconfig que vous souhaitez supprimer, puis cliquez sur OK.
Changer de kubeconfig
Vous pouvez changer de kubeconfig à l'aide de la palette de commandes. Pour changer de fichier kubeconfig:
Ouvrez la palette de commandes, puis exécutez Cloud Code : Switch KubeConfig (Cloud Code : Changer de KubeConfig).
Cliquez sur le kubeconfig que vous souhaitez utiliser.
En savoir plus sur l'assistance à l'édition YAML de Cloud Code
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/04 (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/04 (UTC)."],[[["\u003cp\u003eKubeconfig files are Kubernetes configuration files that manage cluster access, users, and contexts, and Cloud Code utilizes them for various operations.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code defaults to the kubeconfig file in the \u003ccode\u003e$HOME/.kube\u003c/code\u003e directory but allows the addition of other kubeconfig files for managing different contexts.\u003c/p\u003e\n"],["\u003cp\u003eYou can add kubeconfig files in Cloud Code by using the "Cloud Code: Switch kubeconfig" command in the command palette and navigating to the desired file, and you can name them as well.\u003c/p\u003e\n"],["\u003cp\u003eRemoving kubeconfig files in Cloud Code is possible by using the command "Cloud Code: Remove KubeConfig from Kubernetes Explorer", and selecting the files to remove.\u003c/p\u003e\n"],["\u003cp\u003eSwitching between different kubeconfigs is easily done through the command palette by using the "Cloud Code: Switch KubeConfig" command and selecting the desired kubeconfig.\u003c/p\u003e\n"]]],[],null,["# Work with kubeconfig files in Cloud Code for VS Code\n\nkubeconfig files are Kubernetes configuration files that organize cluster\naccess, users, and contexts. This page shows you how to add, delete and switch\nbetween different kubeconfigs in Cloud Code.\n\nFor more information about kubeconfig files, see the Kubernetes documentation on\n[organizing cluster access using kubeconfig files](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/).\n\nManage kubeconfigs\n------------------\n\nBy default, the Cloud Code plugin uses the default kubeconfig file (located\nunder the `$HOME/.kube` directory) for retrieving Kubernetes resources and\nrunning commands. However, additional kubeconfig files may be configured.\n\n### Add additional kubeconfig files\n\nTo add additional kubeconfig files:\n\n1. Open the command palette (press `Ctrl`/`Cmd`+`Shift`+`P` or click **View** \\\u003e **Command Palette** ), and then run **Cloud Code: Switch kubeconfig**.\n2. Click **+ Load kubeconfig**, and then navigate to the location of the kubeconfig file you want to add.\n3. Select the kubeconfig file you want to add, and then click **Add KubeConfig Path**.\n4. Provide a name for the new kubeconfig when prompted.\n5. Press `Enter` to confirm.\n\n### Remove kubeconfig files\n\nTo remove kubeconfig files:\n\n1. Open the command palette (press `Ctrl`/`Cmd`+`Shift`+`P` or click **View** \\\u003e **Command Palette** ), and then run **Cloud Code: Remove KubeConfig from Kubernetes Explorer**.\n2. Select the checkbox next to the kubeconfig you want to remove, and then click **Ok**.\n\n### Switch kubeconfigs\n\nYou can switch kubeconfigs using the **Command palette**. To switch kubeconfigs:\n\n1. Open the **Command palette** , and then run **Cloud Code: Switch KubeConfig**.\n2. Click on the kubeconfig you want to use.\n\nWhat's next\n-----------\n\n- [Organize your cluster access using kubeconfig files](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/).\n- [Develop and debug parts of a microservice application](/code/docs/vscode/speed-up-k8s-development#develop_microservices_applications_using_skaffold_configurations) using skaffold.\n- Learn more about Cloud Code's [YAML editing](/code/docs/vscode/yaml-editing) assistance."]]