Kubernetes에서 애플리케이션을 실행하거나 디버깅하려면 Develop on Kubernetes 실행 구성에 컨테이너 이미지 빌드 방법에 대한 환경설정을 지정해야 합니다.
루트에 skaffold.yaml 파일이 없거나 skaffold.yaml을 참조하지 않는 프로젝트에서 Cloud Code UI를 사용하여 빌더 및 빌드 환경을 선택할 수 있습니다.
로컬 빌드는 자체 리소스를 사용하므로 무료입니다. Cloud Build를 사용하여 빌드하는 것은 대상 클러스터의 프로세서 아키텍처와 일치하지 않는 머신 또는 느린 머신에 적합합니다. Cloud Build를 사용하여 애플리케이션을 빌드하는 비용에 대한 자세한 내용은 Cloud Build 가격 책정을 참조하세요.
skaffold.yaml 파일 없이 기존 애플리케이션을 가져오거나 skaffold.yaml이 없는 애플리케이션을 실행하면 초기화 시 설정을 지정하라는 메시지가 표시됩니다.
Cloud Code 샘플 애플리케이션 중 하나를 사용하는 경우 UI를 사용하려면 빌드 작업을 실행하기 전 skaffold.yaml 파일을 삭제합니다. UI를 사용하지 않고 빌더 및 빌드 환경을 선택하는 단계는 수동으로 Skaffold 구성 만들기를 참조하세요.
skaffold.yaml 파일이 없는 프로젝트에서 명령어 팔레트를 연 다음(Ctrl/Cmd+Shift+P 키를 누르거나 뷰 > 명령어 팔레트 클릭) Cloud Code: Kubernetes에서 실행 또는 Cloud Code: Kubernetes에서 디버그를 실행합니다.
빌드 환경 섹션에서 빌드 환경을 선택합니다.
배포 설정 섹션에서 Cloud Build를 선택한 경우 Cloud Build로 이미지를 푸시할 이미지 레지스트리를 지정합니다.
빌드 설정 섹션에서 각 이미지 및 설정에 빌더(Docker, Jib 또는 buildpack)를 지정합니다.
구성 옵션을 선택하거나 선택 해제한 후 디버그 또는 실행을 클릭합니다.
선택한 옵션은 skaffold.yaml 파일에 저장되며 이 파일을 직접 수정하여 추가로 맞춤설정할 수 있습니다.
기존 skaffold.yaml이 있는 경우
기존 skaffold.yaml 파일이 있는 프로젝트의 경우 빌드 옵션을 수동으로 수정해야 합니다. Cloud Code는 Command/Ctrl + Space를 눌러 볼 수 있는 일반 YAML 스키마의 스니펫을 제공합니다. 자세한 내용은 Skaffold 빌드 문서를 참조하세요.
Cloud Code에서 Skaffold 프로필 사용
Cloud Code는 기본 제공되는 Skaffold 도구를 사용하여 Cloud Code의 빌드 기능을 지원합니다. 로컬 또는 원격 빌드와 같은 다양한 빌드 또는 배포 환경에 맞게 Cloud Code를 구성하려면 Skaffold 프로필이 사용됩니다.
새 skaffold 프로필 만들기
컨텍스트마다 빌드, 테스트, 배포 구성을 정의하려면 Skaffold 프로필이 다를 수 있습니다.
다음 샘플은 Cloud Build로 이미지를 빌드하는 데 사용되는 cloudbuild라는 프로필을 보여줍니다.
profiles:
# use the cloudbuild profile to build images using Google Cloud Build
- name: cloudbuild
build:
googleCloudBuild: {}
프로필이 여러 개 있는 경우 사용하려는 프로필을 launch.json 파일에 추가합니다.
Skaffold 프로필에 대한 자세한 내용은 Skaffold 프로필 문서를 참조하세요.
[[["이해하기 쉬움","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-11(UTC)"],[[["\u003cp\u003eYou can configure how container images are built when running or debugging applications on Kubernetes through the "Develop on Kubernetes" run configuration.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code supports various builders like Docker, Jib, and Buildpacks, and the selection can be made through the UI if a \u003ccode\u003eskaffold.yaml\u003c/code\u003e file is not present.\u003c/p\u003e\n"],["\u003cp\u003eBuilding locally uses your own resources and is free, while Cloud Build is suitable for slower machines or different processor architectures, and is cost-based.\u003c/p\u003e\n"],["\u003cp\u003eSkaffold profiles enable the configuration of different build or deployment environments and can be added to your \u003ccode\u003elaunch.json\u003c/code\u003e file for multiple profile use.\u003c/p\u003e\n"],["\u003cp\u003eWhen importing or running an application without a \u003ccode\u003eskaffold.yaml\u003c/code\u003e file, you will be prompted to specify settings during initialization via the Cloud Code UI, and the settings will be saved to a \u003ccode\u003eskaffold.yaml\u003c/code\u003e file.\u003c/p\u003e\n"]]],[],null,["# Explore your build options with buildpacks, Jib, or Docker\n\nTo run or debug an application on Kubernetes, you'll need to set your\npreference for how your container image is built by configuring it in the\n**Develop on Kubernetes** run configuration.\n\nIn a project that doesn't contain a `skaffold.yaml` file at the root or doesn't\nreference `skaffold.yaml` you can use the Cloud Code UI to choose\na builder and build environment.\n\nBuilding locally is free of charge since it uses your own resources. Building\nwith [Cloud Build](/build) is good for slower machines or machines that\ndon't match the processor architecture of the target cluster. For information\nabout the cost of building your application using Cloud Build, see\n[Cloud Build Pricing](/build/pricing).\n\nSpecify how your images are built\n---------------------------------\n\nCloud Code supports\n[Docker](https://skaffold.dev/docs/pipeline-stages/builders/docker/),\n[Jib](https://skaffold.dev/docs/pipeline-stages/builders/jib/), and\n[Buildpacks](https://skaffold.dev/docs/pipeline-stages/builders/buildpacks/)\n[artifact types](https://skaffold.dev/docs/builders/).\n\n### Without a skaffold.yaml\n\nWhen importing an existing application without a `skaffold.yaml` file or running\nan application that doesn't have a `skaffold.yaml`, you're prompted to specify\nsettings when initializing.\n\nIf you're using one of the Cloud Code sample applications, to use\nthe UI, delete the `skaffold.yaml` file before running a build action. For steps\nto choose a builder and build environment without the UI, see\n[Manually creating a Skaffold configuration](/code/docs/vscode/use-existing-kubernetes-app#manually_create_a_skaffold_configuration).\n\n1. In a project without a `skaffold.yaml` file, open the command palette (press `Ctrl`/`Cmd`+`Shift`+`P` or click **View** \\\u003e **Command Palette** ) and then run **Cloud Code: Run on Kubernetes** or **Cloud Code: Debug on Kubernetes**.\n2. In the **Build environment** section, choose a build environment.\n3. In the **Deploy settings** section, if you chose Cloud Build, specify the image registry you want Cloud Build to push images to.\n4. In the **Build settings** section, specify a builder (Docker, Jib, or buildpacks) for each image and its settings.\n5. Select or clear any of the configuration options and then click **Debug** or **Run**.\n\nThe options you choose are saved to a\n[`skaffold.yaml`](https://skaffold.dev/docs/references/yaml) file that you can\nedit directly for further customization.\n\n### With an existing skaffold.yaml\n\nFor a project with an existing `skaffold.yaml` file, you need to manually edit your build options. Cloud Code provides snippets for common YAML schema viewable by pressing `Command/Ctrl + Space`. See the the [Skaffold Build documentation](https://skaffold.dev/docs/builders/) for more details.\n\nUse Skaffold profiles in Cloud Code\n-----------------------------------\n\nCloud Code uses the Skaffold tool under the hood to power Cloud Code's build functionality. To configure Cloud Code for different build or deploy environments such as local or remote builds, [Skaffold profiles](https://skaffold.dev/docs/environment/profiles/) are used\n\nCreate a new skaffold profile\n-----------------------------\n\nIf you'd like to define build, test and deployment configurations for\ndifferent contexts, you can have different Skaffold profiles.\nThe following sample shows a profile named `cloudbuild` used to to build images with Cloud Build:\n\n\u003cbr /\u003e\n\n profiles:\n # use the cloudbuild profile to build images using Google Cloud Build\n - name: cloudbuild\n build:\n googleCloudBuild: {}\n\nIf you have multiple profiles, add the profile you want to use to your `launch.json` file. For more information on Skaffold profiles, see the [Skaffold profiles documentation](https://skaffold.dev/docs/environment/profiles/)\n\n\u003cbr /\u003e\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- Learn more about [Cloud Native Buildpacks](https://buildpacks.io/).\n- Read about the benefits of [Cloud Build](/build)."]]