本頁面中的部分或全部資訊可能不適用於 Trusted Cloud by S3NS。
在 Cloud Code for VS Code 中使用 kubeconfig 檔案
kubeconfig 檔案是 Kubernetes 設定檔,可整理叢集存取權、使用者和情境。本頁面說明如何在 Cloud Code 中新增、刪除及切換不同的 kubeconfig。
如要進一步瞭解 kubeconfig 檔案,請參閱 Kubernetes 說明文件,瞭解如何使用 kubeconfig 檔案整理叢集存取權。
管理 kubeconfig
根據預設,Cloud Code 外掛程式會使用預設的 kubeconfig 檔案 (位於 $HOME/.kube
目錄下) 擷取 Kubernetes 資源和執行指令。不過,您可以設定其他 kubeconfig 檔案。
新增其他 kubeconfig 檔案
如要新增其他 kubeconfig 檔案,請按照下列步驟操作:
- 開啟指令面板 (按下
Ctrl
/Cmd
+Shift
+P
鍵,或依序點選「View」 >「Command Palette」),然後執行「Cloud Code: Switch kubeconfig」。
- 按一下「+ 載入 kubeconfig」,然後前往要新增的 kubeconfig 檔案位置。
- 選取要新增的 kubeconfig 檔案,然後按一下「Add KubeConfig Path」(新增 KubeConfig 路徑)。
- 出現提示時,請為新 kubeconfig 提供名稱。
- 按下
Enter
確認。
移除 kubeconfig 檔案
如要移除 kubeconfig 檔案,請按照下列步驟操作:
- 開啟指令面板 (按下
Ctrl
/Cmd
+Shift
+P
鍵,或依序點選「View」 >「Command Palette」),然後執行「Cloud Code: Remove KubeConfig from Kubernetes Explorer」(Cloud Code:從 Kubernetes Explorer 移除 KubeConfig)。
- 找出要移除的 kubeconfig,然後勾選旁邊的核取方塊,接著按一下「確定」。
切換 kubeconfig
您可以使用指令區塊面板切換 kubeconfig。如要切換 kubeconfig,請按照下列步驟操作:
- 開啟「Command Palette」,然後執行「Cloud Code: Switch KubeConfig」。
- 按一下要使用的 kubeconfig。
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-11 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-11 (世界標準時間)。"],[[["Kubeconfig files are Kubernetes configuration files that manage cluster access, users, and contexts, and Cloud Code utilizes them for various operations."],["Cloud Code defaults to the kubeconfig file in the `$HOME/.kube` directory but allows the addition of other kubeconfig files for managing different contexts."],["You 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."],["Removing kubeconfig files in Cloud Code is possible by using the command \"Cloud Code: Remove KubeConfig from Kubernetes Explorer\", and selecting the files to remove."],["Switching between different kubeconfigs is easily done through the command palette by using the \"Cloud Code: Switch KubeConfig\" command and selecting the desired kubeconfig."]]],[]]