[[["易于理解","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-04。"],[[["\u003cp\u003eCloud Code simplifies Kubernetes application development by automatically managing minikube, which can be started or stopped via the command palette.\u003c/p\u003e\n"],["\u003cp\u003eUsers can create new applications from pre-built templates available in various languages, or use Cloud Code with an existing project.\u003c/p\u003e\n"],["\u003cp\u003eBefore running an application, it is essential to set the preferred Kubernetes context in the configuration.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code allows for interactive terminal access to containers within the development sessions, and users can view their app's URLs via the Portforward URLs option.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code can also be used with local clusters, like Docker Desktop, by ensuring the cluster is set as the current context in the default configuration.\u003c/p\u003e\n"]]],[],null,["# Use minikube for local development in Cloud Code for Cloud Shell\n\nCloud Code automatically installs and manages minikube. If\nyou opted out of dependency management, add the minikube binary to your `PATH`.\n\nBefore you begin\n----------------\n\n- Install [Git](https://git-scm.com/downloads) so that Cloud Code can perform Git operations, like cloning a sample.\n\nCreate an application from a template\n-------------------------------------\n\nCloud Code comes with a collection of\n[code sample](https://github.com/GoogleCloudPlatform/cloud-code-samples#readme)\ntemplates to get you started quickly. To create a Kubernetes application using\nan existing sample, follow these steps:\n\n1. Launch the Command Palette (press `Ctrl`/`Cmd`+`Shift`+`P` or click **View** \\\u003e **Command Palette** ) and then run **Cloud Code: New Application**.\n2. Select **Kubernetes application** for the type of sample.\n3. Select a sample based on the language you'd like to use from the available options: NodeJS, Go, Python, Java.\n4. Choose a preferred application location on your local machine and then click\n **Create new application** to save.\n\n Cloud Code clones the sample you chose and opens your new\n project for use.\n\nUse your own application\n------------------------\n\nFor steps to use an existing project, see\n[use Cloud Code with an existing Kubernetes application](/code/docs/shell/use-existing-app).\n| **Note:** For developing and testing an app, create and run the application on a non-production cluster. \n| For changes that will be rolled out to production, use an [automated CI/CD workflow](/docs/ci-cd).\n\nSet your Kubernetes context\n---------------------------\n\nBefore running your application, ensure you're set up to deploy your app to\nyour preferred Kubernetes context. You can specify this in your\n[configuration](#configuration).\n\nConfiguration\n-------------\n\nWhen using the **Cloud Code: Develop on Kubernetes** run configuration, you can\ncustomize your deployment by configuring available settings.\nTo add or edit configurations, go to **Run** \\\u003e **Open Configurations** and then edit or add configurations.\n\nCreate and deploy to a minikube cluster\n---------------------------------------\n\n### Start a minikube cluster\n\nCloud Code automatically installs and manages minikube. If\nyou opted out of dependency management, add the minikube binary to your `PATH`.\n\n1. Launch the Command Palette (press `Ctrl`/`Cmd`+`Shift`+`P` or click **View** \\\u003e **Command Palette** ) and then run the **Cloud Code: Control minikube** command.\n2. Click **minikube** for **Choose a Minikube cluster (profile) to control** and then click **Start**.\n\n### Run on minikube\n\n1. Launch the Command Palette and run **Cloud Code: Run on Kubernetes**.\n2. Click **Yes** for **Use current context (minikube) to run the app?**\n3. Cloud Code runs your app in a your minikube cluster. If\n prompted, authorize Cloud Shell to use your credentials to make a\n Google Cloud API call.\n\n View the deployment details in the **Development sessions** section of\n **Cloud Code**.\n4. View the URLs by clicking **Portfoward URLs** in the **Development sessions**\n section, then click the URL link to open your browser with your running\n application.\n\n### Open an interactive terminal to a container\n\n1. Click **Cloud Code** and then expand the **Development Sessions** section.\n2. Expand **Deployed Resources** , then expand **Pods**.\n3. Right-click a container and then click **Get Terminal**.\n\n### Pause or stop a minikube cluster\n\n1. Launch the Command Palette (press `Ctrl`/`Cmd`+`Shift`+`P` or click **View** \\\u003e **Command Palette** ) and then run the **Cloud Code: Control minikube** command.\n2. After the **Choose a Minikube cluster (profile) to control** option populates, click **minikube** and then click **Stop** or **Pause**.\n\nCreate and add a cluster from another cloud provider\n----------------------------------------------------\n\nIf you're using an on-premises cluster or a cluster from another provider such as\nAzure or AWS, use the provider's tools to create the cluster and add it to your\nKubeConfig.\n\nWork with other local clusters\n------------------------------\n\nIn addition to\n[minikube](https://minikube.sigs.k8s.io/docs/start/), you can work with\nCloud Code if you're using Docker Desktop (for\n[Mac](https://docs.docker.com/docker-for-mac/) or\n[Windows](https://docs.docker.com/docker-for-windows/)).\n\nTo get Cloud Code working with a local cluster, make sure that\nyour default configuration (for example, `~/.kube/config`) contains your local\ncluster. This cluster must be set as the current context.\n\nFor example, if you were using a local cluster, `docker-for-desktop`, with\nDocker Desktop, set your preferred cluster by running the following command: \n\n kubectl config use-context docker-for-desktop\n\nWhat's next\n-----------\n\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)"]]