애플리케이션을 설정하면 Kubernetes 클러스터에서 실행하고 skaffold dev를 사용하여 실시간으로 볼 수 있습니다.
Minikube 또는 Docker Desktop과 같은 로컬 클러스터, Google Kubernetes Engine 또는 다른 클라우드 제공업체에서 애플리케이션을 실행할 수 있습니다.
명령어 팔레트를 열고(Ctrl/Cmd+Shift+P 누르기) Cloud Code: Kubernetes에서 실행 명령어를 실행합니다.
현재의 Kubernetes 컨텍스트를 사용하여 앱을 실행할지 또는 선호하는 컨텍스트로 전환할지 확인합니다. Kubernetes 컨텍스트 설정에 대한 자세한 내용은 구성 설정을 참조하세요.
이 선택사항은 cloudcode.kubernetes 시작 구성(.vscode/launch.json에 있음)에 저장됩니다.
Cloud Code가 컨테이너를 빌드하여 레지스트리로 푸시하고 Kubernetes 구성을 클러스터에 적용하여 출시를 기다립니다.
로그 보기
애플리케이션을 개발하고 실행하는 동안 터미널 출력에서 pod를 실시간 스트림으로 보는 로그 외에 Kubernetes 탐색기로 이동하여 특정 pod의 로그를 볼 수 있습니다.
특정 포드의 로그를 보려면 다음 단계를 따릅니다.
Kubernetes 탐색기에서 배포를 펼칩니다.
로그를 보려는 포드를 마우스 오른쪽 버튼으로 클릭한 다음 로그 보기를 클릭합니다.
로그 뷰어가 열립니다.
변경, 다시 빌드, 삭제
시작 구성에서 감시 모드를 false로 설정했고 애플리케이션을 변경한 후 애플리케이션을 다시 빌드하고 다시 배포하려는 경우:
변경사항을 적용하고 저장합니다.
디버그 툴바에서 일시중지(F6)를 클릭한 후 다시 시작(Ctrl/Cmd + Shift + F5)을 클릭하여 애플리케이션을 다시 빌드하고 다시 배포합니다.
애플리케이션 실행을 중지하려면 디버그 툴바에서 중지를 클릭합니다.
애플리케이션을 중지한 후 배포된 모든 Kubernetes 리소스가 클러스터에서 삭제됩니다. 시작 구성에서 cleanUp 플래그를 사용하여 이 동작을 변경할 수 있습니다.
보안 비밀 저장
코드에 API 키, 비밀번호, 인증서와 같이 민감할 수 있는 데이터가 포함된 경우 이를 보안 비밀로 저장하는 것이 좋습니다. Cloud Code를 사용하면 이러한 보안 비밀을 Secret Manager에 안전하게 저장하고 필요할 때 프로그래매틱 방식으로 가져올 수 있습니다.
Cloud Code를 사용하여 보안 비밀을 만들고 관리하는 방법에 대한 자세한 내용은 Secret Manager 가이드를 참조하세요.
리소스 세부정보 보기
Kubernetes 탐색기에는 클러스터, 네임스페이스, 노드, 워크로드(예: 배포, 복제본, 포드, 컨테이너 등), 서비스 및 인그레스, 구성(보안 비밀, 구성 맵 등), 스토리지(볼륨 등)가 표시됩니다.
Kubernetes 탐색기를 사용하면 이러한 리소스 중 일부에 대해 고유한 작업을 수행할 수 있습니다.
[[["이해하기 쉬움","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(UTC)"],[[["\u003cp\u003eCloud Code facilitates the creation of Kubernetes applications from existing templates or projects, offering a quick start with sample code.\u003c/p\u003e\n"],["\u003cp\u003eUsers can configure their Kubernetes deployment by customizing build settings, launch configurations, and selecting their preferred artifact type like Docker, Jib, or Buildpacks.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code allows running applications on various Kubernetes environments, such as local clusters, Google Kubernetes Engine, or other cloud providers, via the \u003ccode\u003eskaffold dev\u003c/code\u003e workflow.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code provides tools for managing secrets via Secret Manager, and monitoring application health and logs via the Kubernetes Explorer.\u003c/p\u003e\n"],["\u003cp\u003eIt's possible to make changes to your application and then rebuild and redeploy it by using the \u003cstrong\u003ePause\u003c/strong\u003e and then \u003cstrong\u003eRestart\u003c/strong\u003e options available on the Debug Toolbar.\u003c/p\u003e\n"]]],[],null,["# Get started with Cloud Code for Cloud Shell for Kubernetes\n\nCloud Code lets you create a Kubernetes application based on a\nsample or from an existing project.\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\nBuild settings\n--------------\n\nCloud Code supports Docker, Jib, and Buildpacks artifact types.\nRefer to the [Configuring container image build preferences guide](/code/docs/shell/image-build-settings)\nto learn about how to set your preferred builder and its relevant settings.\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\nFor more information on customizing your launch configuration, see the\n[Kubernetes in Cloud Code](/code/docs/shell/k8s-overview#customize_your_launch_configuration).\n| **Note:** Cloud Code is built to work with [Cloud Build](/build/docs). To build an existing application using Google Cloud infrastructure, see the [Skaffold docs for Cloud Build](https://skaffold.dev/docs/pipeline-stages/builders/docker/#dockerfile-remotely-with-google-cloud-build).\n\nRun your application\n--------------------\n\nOnce you have an application set up, you can run it on a Kubernetes cluster and\nview it live, by leveraging\n[`skaffold dev`](https://skaffold.dev/docs/workflows/dev).\nYou can run your application on a local cluster (like minikube or Docker\nDesktop), Google Kubernetes Engine, or any other Cloud provider.\n| **Note:** If you're working with a private Autopilot cluster, you might run into an image pull error when pulling an image outside of the image registry for your project, such as by using Docker Hub. To resolve this issue, you can either host the image on [Artifact Registry](/artifact-registry/docs/docker/pushing-and-pulling) or provide [outbound internet access for your private nodes](/nat/docs/gke-example#create-nat).\n\n1. Open the Command Palette (press `Ctrl`/`Cmd`+`Shift`+`P`) and then run the **Cloud Code: Run on Kubernetes** command.\n2. Confirm whether to use the current [Kubernetes context](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#context) to run the app in (or switch to a preferred one). For more information about setting up a Kubernetes context, see [setting up configuration](/code/docs/vscode/use-existing-app#setting_up_configuration).\n3. If you chose a remote cluster as the context, when prompted, choose an image\n registry to push the images to. If your project has\n [Artifact Registry API enabled](/artifact-registry/docs/enable-service) and at least one\n [Artifact Registry repository](/artifact-registry/docs/manage-repos), you can\n browse to and select an existing Artifact Registry repository.\n\n The following samples demonstrate how to specify where container images are\n stored for some common registries:\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\n Cloud Code concatenates this image registry with the image name\n specified in the Kubernetes manifests to generate the final image repository\n name.\n\n For more information, see the\n [image registry handling guide](https://skaffold.dev/docs/environment/image-registries).\n\n This choice is stored in your `cloudcode.kubernetes` launch configuration\n (found in .vscode/launch.json).\n\n Cloud Code builds your containers, pushes them to the registry,\n applies Kubernetes configurations to the cluster, and waits for the rollout.\n\nView logs\n---------\n\nIn addition to seeing logs from running pods as a live stream in the terminal\noutput as you're developing and running your application, you can view logs from\na specific pod by navigating to the Kubernetes Explorer.\n\nTo view logs from a specific pod, follow these steps:\n\n1. In the Kubernetes Explorer, expand **Deployments**\n2. Right-click the pod you'd like to see logs from, and then click\n **View Logs**.\n\n The **Logs viewer** opens.\n\nMake changes, rebuild, and clean up\n-----------------------------------\n\nIf you've set watch mode to `false` in your launch configuration and you want to make changes to your application and then rebuild and redeploy the application:\n\n\u003cbr /\u003e\n\n1. Make and Save your changes.\n\n2. In the Debug Toolbar, click **Pause** (`F6`) and then click\n **Restart** (`Ctrl/Cmd + Shift + F5`) to rebuild and redeploy the\n application.\n\n3. To stop running the application, in the Debug Toolbar, click **Stop**.\n\nAfter you stop the application, all deployed Kubernetes resources are\ndeleted from the cluster. You can change this behavior using the `cleanUp`\nflag in your launch configuration.\n\nStore secrets\n-------------\n\nIf your code includes potentially sensitive data like API keys, passwords, and\ncertificates, it is recommended you store them as secrets. With\nCloud Code, you can securely store these secrets in\nSecret Manager and programmatically fetch them when you need them.\n\nFor a detailed look at how you can create and manage secrets with\nCloud Code, see the\n[Secret Manager guide](/code/docs/shell/secret-manager).\n\nView resource details\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\nSee the [Kubernetes overview](/code/docs/shell/k8s-overview#resource-specific_actions) for more\ninformation on viewing resource details.\n\nWhat's next\n-----------\n\n- [Explore your build options with buildpacks, Jib, or Docker](/code/docs/shell/image-build-settings).\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- Learn more about Cloud Code's [YAML editing](/code/docs/shell/yaml-editing) assistance."]]