[[["わかりやすい","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-02-17 UTC。"],[[["\u003cp\u003eCloud Code simplifies Kubernetes development by managing minikube and providing templates for quick application creation.\u003c/p\u003e\n"],["\u003cp\u003eUsers can create new Kubernetes applications using pre-built samples in various languages like Node.js, Go, Python, and Java.\u003c/p\u003e\n"],["\u003cp\u003eThe structure of sample applications, such as the Node.js Guestbook, includes configuration files like \u003ccode\u003elaunch.json\u003c/code\u003e, deployment specifications in \u003ccode\u003ekubernetes-manifests\u003c/code\u003e, and server logic in \u003ccode\u003esrc\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code enables running and debugging applications on a minikube cluster and offers features like port forwarding to view deployed apps.\u003c/p\u003e\n"],["\u003cp\u003eThe tool supports working with other local clusters like Docker Desktop and allows the use of clusters from other providers by adding them to your KubeConfig.\u003c/p\u003e\n"]]],[],null,["# Use minikube for local development in Cloud Code for VS Code\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\n1. Install [Git](https://git-scm.com/downloads) so that Cloud Code can perform Git operations, like cloning a sample.\n2. Install the [Cloud Code plugin](/code/docs/vscode/install) if you haven't already.\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\n### Sample application structure\n\nAll language sample applications have nearly the same structure. This\nis not the only supported structure but is recommended when starting.\n\nFor example, the Node.js Guestbook application structure looks like: \n\n .\n |---- .vscode\n | └---- launch.json\n |---- kubernetes-manifests\n | |---- guestbook-backend.deployment.yaml\n | |---- guestbook-backend.service.yaml\n | |---- guestbook-frontend.deployment.yaml\n | |---- guestbook-frontend.service.yaml\n | |---- mongo.deployment.yaml\n | └---- mongo.service.yaml\n |---- src\n | |---- backend\n | | |---- Dockerfile\n | | |---- index.js\n | | |---- app.js\n | | └---- package.json\n | |---- frontend\n | |---- Dockerfile\n | |---- index.js\n | | |---- app.js\n | └---- package.json\n └---- skaffold.yaml\n\nTaking a closer look at this Kubernetes Guestbook Node.js sample app, here are\nsome key files and their uses:\n\n- .vscode\n - `extensions.json`: prompt requesting download of related extensions when opening this project\n - `launch.json`: launch configuration (of type `cloudcode.kubernetes`) to run or debug the Kubernetes application\n - `tasks.json`: configuration information for [Visual Studio Code Tasks](https://code.visualstudio.com/docs/editor/tasks)\n- kubernetes-manifests\n - `guestbook-backend.deployment.yaml`: Pod specification for the backend nodes\n - `guestbook-frontend.deployment.yaml`: Pod specification for the frontend nodes\n - `mongo.deployment.yaml`: Pod specification for the database\n- src\n - `(backend|frontend)/app.js`: Node.js code with the web server logic\n - `(backend|frontend)/Dockerfile`: used to build the container image for our program\n- `skaffold.yaml`: config file for [Skaffold](/skaffold), which Cloud Code uses to build, deploy and debug Kubernetes applications\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/vscode/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| **Note:** minikube is incompatible with ChromeOS. See [issue 6411](https://github.com/kubernetes/minikube/issues/6411) for details.\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** explorer.\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/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)\n\nGet Support\n-----------\n\nTo send feedback, report issues on [GitHub](https://github.com/GoogleCloudPlatform/cloud-code-vscode/issues), or ask a question on [Stack Overflow](https://stackoverflow.com/questions/ask?tags=cloud-code-vscode)."]]