Utilizzare i file kubeconfig in Cloud Code per VS Code
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
I file kubeconfig sono file di configurazione di Kubernetes che organizzano l'accesso, gli utenti e i contesti del cluster. Questa pagina mostra come aggiungere, eliminare e passare da un kubeconfig all'altro in Cloud Code.
Per impostazione predefinita, il plug-in Cloud Code utilizza il file kubeconfig predefinito (nella directory $HOME/.kube) per recuperare le risorse Kubernetes ed eseguire i comandi. Tuttavia, è possibile configurare file kubeconfig aggiuntivi.
Aggiungere altri file kubeconfig
Per aggiungere altri file kubeconfig:
Apri la tavolozza dei comandi (premi Ctrl/Cmd+Shift+P o fai clic su
Visualizza > Tavolozza comandi) e poi esegui
Cloud Code: Switch kubeconfig.
Fai clic su + Carica kubeconfig, quindi vai alla posizione del
file kubeconfig da aggiungere.
Seleziona il file kubeconfig da aggiungere e fai clic su
Aggiungi percorso KubeConfig.
Quando richiesto, fornisci un nome per il nuovo file kubeconfig.
Premi Enter per confermare.
Rimuovere i file kubeconfig
Per rimuovere i file kubeconfig:
Apri la tavolozza dei comandi (premi Ctrl/Cmd+Shift+P o fai clic su Visualizza > Tavolozza comandi) e poi esegui Cloud Code: Rimuovi KubeConfig da Kubernetes Explorer.
Seleziona la casella di controllo accanto al file kubeconfig da rimuovere e poi fai clic su Ok.
Cambiare i file kubeconfig
Puoi cambiare i file kubeconfig utilizzando la Tavolozza dei comandi. Per cambiare kubeconfig:
Apri la Tavolozza comandi ed esegui Cloud Code: Switch KubeConfig.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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."]]