Mit kubeconfig-Dateien in Cloud Code für VS Code arbeiten
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
kubeconfig-Dateien sind Kubernetes-Konfigurationsdateien, mit denen der Clusterzugriff, Nutzer und Kontexte organisiert werden. Auf dieser Seite erfahren Sie, wie Sie in Cloud Code verschiedene kubeconfigs hinzufügen, löschen und wechseln.
Standardmäßig verwendet das Cloud Code-Plug-in zum Abrufen von Kubernetes-Ressourcen und zum Ausführen von Befehlen die kubeconfig-Standarddatei (die sich im Verzeichnis $HOME/.kube befindet). Es können jedoch zusätzliche kubeconfig-Dateien konfiguriert werden.
Zusätzliche kubeconfig-Dateien hinzufügen
So fügen Sie zusätzliche kubeconfig-Dateien hinzu:
Öffnen Sie die Befehlspalette (drücken Sie Ctrl/Cmd + Shift + P oder klicken Sie auf Ansicht > Befehlspalette) und führen Sie dann Cloud Code: kubeconfig wechseln aus.
Klicken Sie auf + Kubeconfig laden und gehen Sie dann zum Speicherort der hinzuzufügenden kubeconfig-Datei.
Wählen Sie die kubeconfig-Datei aus, die Sie hinzufügen möchten, und klicken Sie dann auf KubeConfig-Pfad hinzufügen.
Geben Sie auf Aufforderung einen Namen für die neue kubeconfig-Datei an.
Drücken Sie zum Bestätigen auf Enter.
kubeconfig-Dateien entfernen
So entfernen Sie kubeconfig-Dateien:
Öffnen Sie die Befehlspalette (drücken Sie Ctrl/Cmd + Shift + P oder klicken Sie auf Ansicht > Befehlspalette) und führen Sie dann Cloud Code: KubeConfig aus dem Kubernetes Explorer entfernen aus.
Klicken Sie auf das Kästchen neben der kubeconfig, die Sie entfernen möchten, und dann auf Ok.
Kubeconfigs wechseln
Sie können über die Befehlspalette zwischen den kubeconfigs wechseln. So wechseln Sie die kubeconfig:
Öffnen Sie die Befehlspalette und führen Sie dann Cloud Code: KubeConfig wechseln aus.
[[["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-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."]]