[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eCloud Code's Kubernetes section within your IDE provides access to information about your clusters, nodes, and workloads, allowing you to manage them directly.\u003c/p\u003e\n"],["\u003cp\u003eYou can manage Kubernetes resources through the Kubernetes section, including adding or switching Kubeconfig files, setting the current context, and streaming logs.\u003c/p\u003e\n"],["\u003cp\u003eThe Development sessions section in Cloud Code allows for running and debugging Kubernetes applications, or creating new sample applications.\u003c/p\u003e\n"],["\u003cp\u003eThe Kubernetes section offers quick actions such as refreshing, viewing resource details, and copying resource names, along with resource-specific actions for clusters, namespaces, pods, containers, deployments, and nodes.\u003c/p\u003e\n"],["\u003cp\u003eYou can configure how your application is run by customizing your \u003ccode\u003eskaffold.yaml\u003c/code\u003e file, and your launch configurations, including specifying build and deploy settings, image registry, port forwarding, cleanup options, and more.\u003c/p\u003e\n"]]],[],null,["# Cloud Code for VS Code Kubernetes overview\n\nThis page provides an overview of Kubernetes development in\nCloud Code.\n\nUse the Kubernetes section in Cloud Code\n----------------------------------------\n\nThe **Kubernetes** section lets you access information about your\n[clusters](#clusters), nodes, workloads, and more, right from your IDE.\nYou can also [set a current context](#clusters), [stream and view logs](#pods),\n[open an interactive terminal](#launch_a_terminal), and\n[look up resource descriptions](#describe_resources) with the Kubernetes\nsection.\n\n\u003cbr /\u003e\n\nCloud Code uses the default kubeconfig file, located under\nthe `$HOME/.kube` directory on MacOS/Linux or `%USERPROFILE%\\.kube` on Windows,\nfor retrieving Kubernetes resources. You can switch or add new Kubeconfig files\nfrom within the Kubernetes section. Kubeconfig files are YAML files\ncontaining your Kubernetes cluster details, certificate, and secret token for\nauthenticating to the cluster.\n\nTo use a kubeconfig file other than the default kubeconfig, refer to the\n[Work with kubeconfig files](/code/docs/intellij/kubeconfigs) guide.\n\nAccess the Kubernetes section\n-----------------------------\n\nTo view and manage your Kubernetes resources, access the **Kubernetes** section by clicking **Cloud Code** and expanding the **Kubernetes** section. To view debugging sessions or create a sample app, expand the **Development sessions** section.\n\n\u003cbr /\u003e\n\nWhen attempting to debug, you may be prompted to [authenticate your credentials\nto run and debug an application\nlocally](/code/docs/vscode/install#authenticate_credentials_for_debugging_applications_locally).\n\nAccess the Development sessions section\n---------------------------------------\n\nUse the Development sessions to run or debug your Kubernetes application or create\na sample application using a template.\n\n\nWhen you start a development or debugging session, the\n**Development sessions** section displays the structured logging view.\n\nTo access the Development sessions, click **Cloud Code** and expand the **Development sessions** section.\n\n\u003cbr /\u003e\n\nBasic actions\n-------------\n\nThe **Kubernetes** section is powered by `kubectl`. As long as you've\nconfigured your `kubectl` config file to access your clusters, you can use the\n**Kubernetes** section to add clusters, browse all your available\nnamespaces, resources, and nodes for your clusters, regardless of them being in\nthe active or inactive context.\n\n### Kubernetes section\n\nThe available general Kubernetes actions, accessible through their icons in the\n**Kubernetes** section, are:\n\n- add KubeConfig\n- refresh Refresh the **Kubernetes** section\n- question_mark Open the Cloud Code Kubernetes documentation in a web browser\n\n### Development sessions section\n\nThe available Kubernetes actions, accessible through their icons in the\nKubernetes **Development sessions** section, are:\n\n- Open a Kubernetes sample application\n- play_arrow Run your application\n- Debug your application\n\n### Copy a resource name\n\nYou can copy any Kubernetes resource name to the clipboard (including container\nand cluster names). To copy a resource name, right-click on the resource and\nchoose **Copy resource name**.\n\n\u003cbr /\u003e\n\n### Refresh resources\n\nThe **Kubernetes** section watches for changes and automatically\nrefreshes to reflect updates. To force a refresh of any Kubernetes resource to\nfetch its latest information, right-click the resource and choose **Refresh**.\n\n\u003cbr /\u003e\n\nYou can also force a refresh of the entire **Kubernetes** section using the **Kubernetes** section's refresh button.\n\n\u003cbr /\u003e\n\n### Describe resources\n\nTo display the details of any non-cluster resource, right-click the resource, then select **Describe** . A terminal opens and displays the resource information.\n\n\u003cbr /\u003e\n\nCustomize your launch configuration\n-----------------------------------\n\nTo configure how your application is run, you can customize your\n[`skaffold.yaml`](https://skaffold.dev/docs/references/yaml) file.\nYou can also configure your launch by specifying the following fields in the `cloudcode.kubernetes` configuration in your `.vscode/launch.json` file:\n\n\u003cbr /\u003e\n\n- **skaffoldConfig:** Specify the [Skaffold configuration](https://skaffold.dev/docs/references/yaml/) file that contains the build and deploy settings.\n- **profile:** Specify your preferred [Skaffold profile](https://skaffold.dev/docs/environment/profiles/). If not defined, the default profile is used.\n- **imageRegistry:** Specify the image registry to push images to.\n- **watch**: Specify whether to watch for changes in the workspace and rerun the application. Unless explicitly set to false, true by default.\n- **cleanUp**: Specify whether to delete deployed Kubernetes resources in the cluster after the application is terminated. Unless explicitly set to false, true by default.\n- **portForward** : Specify whether to [forward ports](https://skaffold.dev/docs/pipeline-stages/port-forwarding/) for exposed Kubernetes resources on your cluster to your local machine. Unless explicitly set to false, true by default.\n\n### View remote YAML\n\nTo view the YAML of a resource in your cluster, select or hover over the resource to show the **Edit YAML** and **View YAML** icons. Select the **View YAML** button to open the YAML file corresponding to your specified resource in a new editor tab.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### View logs\n\nYou can stream and view logs from Kubernetes resources into the Kubernetes\nsection console to monitor their progress.\nTo open the **logs viewer** , open the command palette by pressing `Ctrl/Cmd+Shift+P` or clicking **View \\\u003e Command Palette** then select **Cloud Code: View Logs** .\n\n\u003cbr /\u003e\n\nThe **logs viewer** opens in a new editor tab.\n\n\nTo view logs for a pod or container, right click on the resource and select\n**View logs**.\n\n### Launch a terminal\n\nFor pods and containers, you can open an interactive terminal by right-clicking\nthe pod or container and selecting **Get terminal**.\n\n\u003cbr /\u003e\n\nResource-specific actions\n-------------------------\n\nThe Kubernetes section displays clusters, namespaces, nodes, workloads\n(such as deployments, replicasets, pods and containers), services and ingresses,\nconfigurations (such as secrets and config maps) and storage (such as volumes).\nUsing the Kubernetes section, you can perform unique actions on some\nof these resources.\n\n\u003cbr /\u003e\n\n### Clusters\n\n- **Add a cluster to the Kubeconfig:** Add an existing GKE or minikube cluster or create a new one.\n\nThe Add Cluster dialog appears and you can choose the project and cluster\nyou'd like to use or create a new cluster.\n\n\u003cbr /\u003e\n\n- **Set as active cluster:** Set the specified cluster as active such that your\n configured `kubectl` context accesses this cluster by default.\n\nThe Kubernetes section refreshes automatically and you'll see the\nKubernetes symbol next to the appropriate cluster.\n\nIf a cluster has multiple contexts configured, you'll be able\nto choose one of the available contexts to set as the current context.\n\n### Namespaces\n\n- **Set as active namespace:** Set a namespace as active such that your\n configured `kubectl` context accesses this namespace by default.\n\n Right-click the namespace you want to set as active.\n\nIf this action is successful, the Kubernetes section refreshes automatically and you'll see an asterisk next to the namespace to signify that it's part of the current context.\n\n\u003cbr /\u003e\n\nNote that a Kubernetes context is a shortcut which gives you quick access\nto a namespace in your cluster. Contexts are normally created\nautomatically when you start a minikube or GKE cluster. If you don't see\nthe **Set as current context** option for a given namespace and you'd\nlike to create a context for it, use the\n[`kubectl config set-context` command](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-em-set-context-em-)\nin your terminal to set a context with your preferred cluster, user, and\nnamespace.\n\n### Pods\n\n- **View Logs:** [View logs](#view_logs) from a pod into the Kubernetes section Console.\n- **Get Terminal:** [Get terminal](#launch_a_terminal) for a pod in the Kubernetes section Console.\n\n Additionally, running pods have colored status marks next to their labels:\n - **Red**: Pod is in a failed state\n - **Yellow**: Pod is starting or terminating\n - **Green**: Pod is healthy and running\n\n\u003cbr /\u003e\n\n### Containers\n\n- **View logs:** [View logs](#view_logs) from a container into the Kubernetes section console.\n- **Get Terminal:** [Get terminal](#launch_a_terminal) for a container in the Kubernetes section console.\n\n### Deployments\n\n- **View logs:** [View logs](#view_logs)\n from a deployment into the Kubernetes section console.\n\n Live deployments have colored status marks next to their labels and counts of\n current/total replicas:\n - **Yellow**: Deployment does not have minimum availability or have image problems.\n - **Green**: Deployment is healthy and had minimum availability.\n\n\u003cbr /\u003e\n\n### Nodes\n\nNodes of your cluster have colored status marks next to their names:\n\n- **Yellow**: Node has a resource problem such as memory or disk availability.\n- **Green**: Node is healthy.\n\n### Custom Resource Definitions (CRDs)\n\nThe Kubernetes section lists all Custom Resource Definitions (CRDs)\ninstalled and available on your cluster:\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\n- [Get started with Cloud Code for VS Code for Kubernetes](/code/docs/vscode/get-started-k8s) by creating and deploying a Kubernetes application from a code sample.\n- Use [file sync and hot reloading](/code/docs/vscode/speed-up-k8s-development#enable-skaffold-file-sync-and-hot-reloading) to speed up development.\n- [Debug your application in Cloud Code](/code/docs/vscode/debug)"]]