[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-05。"],[[["\u003cp\u003eThe Kubernetes Explorer in Cloud Code allows users to manage and access information about their Kubernetes clusters, nodes, and workloads directly from their IDE.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code utilizes the default kubeconfig file for Kubernetes resource retrieval, and users can switch or add new kubeconfig files through the Kubernetes Explorer.\u003c/p\u003e\n"],["\u003cp\u003eThe Development sessions section in Cloud Code facilitates running, debugging, and creating sample Kubernetes applications using pre-defined templates.\u003c/p\u003e\n"],["\u003cp\u003eUsers can perform actions like viewing logs, launching interactive terminals, describing resources, and refreshing data directly from the Kubernetes Explorer for various Kubernetes resources like pods, containers, and deployments.\u003c/p\u003e\n"],["\u003cp\u003eThe Kubernetes Explorer displays the health status of various resources, such as pods, deployments, and nodes, using colored indicators (red, yellow, green) to quickly identify potential issues.\u003c/p\u003e\n"]]],[],null,["# Cloud Code for Cloud Shell Kubernetes overview\n\nThis page provides an overview of Kubernetes development in\nCloud Code.\n\nUse the Kubernetes Explorer in Cloud Code\n-----------------------------------------\n\nThe **Kubernetes** Explorer 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\nExplorer.\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 Explorer. 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 Explorer\n------------------------------\n\nTo view and manage your Kubernetes resources, access the **Kubernetes** Explorer 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\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** Explorer is powered by `kubectl`. As long as you've\nconfigured your `kubectl` config file to access your clusters, you can use the\n**Kubernetes** Explorer 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### Clusters section\n\nThe available general Kubernetes actions, accessible through their icons in the\nKubernetes Explorer **Clusters** section, are:\n\n- add Add a cluster to the KubeConfig\n- refresh Refresh the **Kubernetes** Explorer\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### Refresh resources\n\nThe **Kubernetes** Explorer 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** Explorer **Clusters** section using the **Clusters** 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\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.\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\nExplorer 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 Explorer 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 Explorer, 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 Explorer 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 Explorer 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 Explorer Console.\n- **Get Terminal:** [Get terminal](#launch_a_terminal) for a pod in the Kubernetes Explorer 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 Explorer console.\n- **Get Terminal:** [Get terminal](#launch_a_terminal) for a container in the Kubernetes Explorer console.\n\n### Deployments\n\n- **View logs:** [View logs](#view_logs)\n from a deployment into the Kubernetes Explorer 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 Explorer 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 Cloud Shell for Kubernetes](/code/docs/shell/get-started-k8s) by creating and deploying a Kubernetes application from a code sample.\n- Use [file sync and hot reloading](/code/docs/shell/speed-up-k8s-development#enable-skaffold-file-sync-and-hot-reloading) to speed up development.\n- [Debug your application in Cloud Code](/code/docs/shell/debug)"]]