IntelliJ용 Cloud Code에서 로컬 개발 속도를 높이려면 파일 동기화와 핫 리로드, 저장 시 자동 배포의 이점을 활용하고 Skaffold 모듈을 사용하여 애플리케이션의 일부를 별도로 개발합니다.
Skaffold 파일 동기화 및 핫 리로드(Hot reloading) 사용 설정
Skaffold는 로컬 개발 워크플로의 효율성을 높이고 포드를 다시 빌드, 다시 배포, 다시 시작할 필요가 없도록 변경된 파일을 배포된 컨테이너에 복사하는 기능을 지원합니다. 즉, 정적 및 소스 코드 파일을 변경하면 몇 초 만에 변경사항이 적용되며 신속한 피드백 루프가 발생합니다.
정적 파일(예: HTML 및 CSS 파일)의 경우 이 파일 복사 동작을 파일 동기화라고 합니다.
소스 코드 파일의 경우 이 동작을 핫 리로드(Hot reloading)라고 하며 다음 파일 유형을 지원합니다.
파일 동기화 및 핫 리로드를 설정한 후 반복 주기를 시작하고 프로젝트에 더 많은 기능을 추가합니다. 배포를 중단 및 삭제하거나, 이미지를 수동으로 빌드 및 태그 지정하거나, 클러스터를 업데이트하지 않아도 Kubernetes 클러스터에 변경사항이 배포됩니다.
표준 반복 주기는 다음 단계와 유사합니다.
프로젝트를 변경합니다. 예를 들어 Cloud Code Java 방명록 앱을 사용하는 경우 다음과 같이 FrontendController 클래스에 새 엔드포인트를 추가합니다.
src/main/java/cloudcode/guestbook/frontend에서 FrontendController.java 파일을 열고 다음을 추가합니다.
@RequestMapping("/greeting")@ResponseBodypublicStringgreeting(@RequestParam(value="name",defaultValue="World")Stringname){returnString.format("Hello from Kubernetes with IntelliJ, %s!",name);}
새 주석 RequestMapping 및 ResponseBody에 대한 필요한 가져오기를 포함합니다.
변경사항을 저장하거나(Ctrl/Cmd+S) 프로젝트를 빌드합니다.
콘솔 창에서 진행 상황 및 배포 로그를 확인할 수 있습니다.
변경사항이 배포된 후 업데이트를 확인합니다.
지속적 개발 세션을 종료하려면 중지 아이콘을 클릭합니다.
Cloud Code는 개발 세션에 사용된 모든 Kubernetes 리소스를 삭제합니다.
Skaffold 구성을 사용하여 마이크로서비스 애플리케이션 개발
마이크로서비스 애플리케이션을 개발할 때 디버깅과 배포를 단순화하려면 별도의 섹션에서 독립적으로 작업하는 것이 유용할 수 있습니다.
애플리케이션을 Skaffold 모듈로 분할하여 애플리케이션 부분을 독립적으로 개발 및 디버깅할 수 있습니다. 예를 들어 Bank of Anthos 샘플은 10개의 마이크로서비스가 포함된 애플리케이션입니다. 샘플의 skaffold.yaml 파일은 이러한 서비스를 setup, db, frontend, backend, loadgenerator라는 5개의 skaffold 모듈로 그룹화합니다.
Skaffold 모듈 및 구성 종속 항목 정의
Skaffold 모듈 및 구성 종속 항목을 정의하려면 다음 안내를 따르세요.
모듈을 정의하려는 프로젝트를 엽니다.
skaffold.yaml 파일을 엽니다.
skaffold.yaml 파일에 여러 구성이 포함된 경우 구성을 Skaffold 모듈로 만들려면 다음 줄을 지정합니다.
metadata:name:MODULE_NAME_1
예를 들어 Bank of Anthos skaffold.yaml에서 db 모듈은 데이터베이스 배포를 정의합니다.
빌드 및 배포(모듈을 사용할 수 있는 경우)를 선택한 다음 빌드하고 배포할 모듈을 선택합니다.
선택 사항은 이후 배포에서 유지됩니다. 모듈의 하위 집합을 선택하면 Cloud Code에서 전체 시스템이 아닌 모듈의 하위 집합 배포에 대한 경고가 표시됩니다.
Kubernetes에서 지속적 개발
원하는 옵션으로 실행 대상을 구성한 다음에는 애플리케이션의 정기 실행을 선택하거나 IDE에서 개발 반복 주기를 시작하여 소스 및 종속 항목의 변경사항을 운영 중인 애플리케이션에 전파할 수 있습니다.
Kubernetes에서 개발 실행 대상은 Kubernetes 클러스터에서 개발 주기를 시작합니다. 개발 주기를 시작하면 Cloud Code에서 Skaffold를 사용하여 프로젝트 이미지를 빌드한 다음 태그를 지정하고 구성된 저장소에 푸시한 후 kubectl을 사용하여 프로젝트 Kubernetes 매니페스트를 배포합니다.
Kubernetes에서 개발 아이콘을 클릭한 다음 구성 수정을 클릭하여 실행/디버그 구성 대화상자를 엽니다.
변경사항을 저장한 후 Cloud Code가 애플리케이션을 자동으로 다시 배포하도록 하려면 감시 모드 - 다시 빌드 및 재배포에서 파일 저장형을 선택합니다. 새 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-05(UTC)"],[[["\u003cp\u003eSkaffold enhances local development with file syncing for static files and hot reloading for source code, allowing changes to be reflected in seconds without rebuilding or restarting pods.\u003c/p\u003e\n"],["\u003cp\u003eAutomatic file syncing and hot reloading are enabled by default with Buildpacks, while other builders like Docker require a \u003ccode\u003esync\u003c/code\u003e section in the \u003ccode\u003eskaffold.yaml\u003c/code\u003e file for configuration.\u003c/p\u003e\n"],["\u003cp\u003eChanges to the application are deployed to the Kubernetes cluster without manual intervention when the development cycle is running.\u003c/p\u003e\n"],["\u003cp\u003eSkaffold modules allow for independent development and debugging of microservice sections by splitting an application into different modules, defining configuration dependencies, and selecting specific modules to build and deploy.\u003c/p\u003e\n"],["\u003cp\u003eThe "Develop on Kubernetes" run target starts the development cycle, allowing for automatic redeployment on file save and enabling the use of Skaffold modules to fine-tune the development process.\u003c/p\u003e\n"]]],[],null,["# Speed up development in Cloud Code for IntelliJ\n\nTo speed up your local development in Cloud Code for IntelliJ, take advantage of file\nsync and hot reloading, automatic deployment on save, and use Skaffold modules\nto develop portions of an application separately.\n\nEnable Skaffold file sync and hot reloading\n-------------------------------------------\n\nTo improve the efficiency of your local development workflow and avoid\nhaving to rebuild, redeploy, and restart your pods, [Skaffold](/skaffold) supports\ncopying changed files to a deployed container. This means that when you're making changes to static\nand source code files, you can see your changes take effect in seconds, making for an accelerated\nfeedback loop.\n\nFor static files (like HTML and CSS files), this file copying behavior is called\n**file syncing**.\n\nFor source code files, this behavior is called as **hot reloading** and supports\nthe following file types:\n\n- Go: \\*.go\n- Java: \\*.java, \\*.kt, \\*.scala, \\*.groovy, \\*.clj\n- NodeJS: \\*.js, \\*.mjs, \\*.coffee, \\*.litcoffee, \\*.json\n\nWith hot reloading configured, Skaffold detects changes to supported files and syncs these\nchanges to the running container on your cluster. Changes to file types that don't support hot\nreloading trigger an image rebuild and pod restart.\n\nAutomatic file-syncing and hot reloading are enabled by default when you're\nworking with Buildpacks as your preferred builder. For other builders like\nDocker, you can specify a `sync` section in your `skaffold.yaml` file for the\nartifact you're customizing.\n\nYour sync setting can be one of (in order of preference):\n\n- `auto`: Skaffold automatically configures the sync. (only for Jib and Buildpacks artifacts.) This is the default for Buildpacks.\n- `infer`: The destinations for each changed file are inferred from the builder.\n- `manual`: You must specify the files in your local workspace and their destination in the running container.\n\nThe following sample `sync` section in a `skaffold.yaml` file specifies a\n`manual` sync to synchronize all `/static-html` HTML files to the `static`\nfolder in a container: \n\n```yaml\nbuild:\n artifacts:\n - image: gcr.io/k8s-skaffold/node-example\n context: node\n sync:\n manual:\n - src: 'static-html/*.html'\n dest: static\n```\n\nFor a detailed look at file syncing and specifying sync rules, see the\n[Skaffold guide on file sync](https://skaffold.dev/docs/filesync/).\n\nAdd new features when developing on Kubernetes\n----------------------------------------------\n\nAfter setting up file sync and hot reloading, start an iteration cycle and add\nmore features to your project. Your changes are deployed to your Kubernetes\ncluster without stopping and removing the deployment, manually building and\ntagging the image, or updating the cluster.\n\nA standard iteration cycle resembles the following:\n\n1. Make a change in your project. For example, if using the\n Cloud Code Java Guestbook app, add a new endpoint to the\n `FrontendController` class as follows:\n\n 1. Open the `FrontendController.java` file from\n `src/main/java/cloudcode/guestbook/frontend` and add the following:\n\n @RequestMapping(\"/greeting\")\n @ResponseBody\n public String greeting(@RequestParam(value=\"name\", defaultValue=\"World\") String name) {\n return String.format(\"Hello from Kubernetes with IntelliJ, %s!\", name);\n }\n\n 2. Add the necessary imports for the new annotations, `RequestMapping` and\n `ResponseBody`.\n\n2. Save your changes (`Ctrl`/`Cmd+S`) or build the project.\n\n You can watch the progress and deployment logs in the console window.\n After the changes are deployed, confirm the updates.\n3. To end the continuous development session, click the **Stop** icon.\n\n Cloud Code deletes all Kubernetes resources used for the development session.\n\nDevelop microservices applications using Skaffold configurations\n----------------------------------------------------------------\n\nWhen developing microservice applications, it can be useful to work on separate\nsections independently to simplify debugging and deployment.\n\nYou can develop and debug parts of your application independently by splitting\nyour application into [Skaffold modules](/code/docs/intellij/skaffold-modules). For example, the\n[Bank of Anthos](https://github.com/GoogleCloudPlatform/bank-of-anthos) sample\nis an application containing ten microservices. The sample's\n[`skaffold.yaml`](https://github.com/GoogleCloudPlatform/bank-of-anthos/blob/main/skaffold.yaml)\nfile groups these services into five skaffold modules named `setup`, `db`,\n`frontend`, `backend`, and `loadgenerator`.\n\n### Define Skaffold modules and configuration dependencies\n\nTo define Skaffold modules and configuration dependencies:\n\n1. Open the project where you want to define the modules.\n\n2. Open the `skaffold.yaml` file.\n\n3. If your `skaffold.yaml` file has multiple configurations, to make a\n configuration a Skaffold module, specify the following line:\n\n metadata:\n name: MODULE_NAME_1\n\n For example, in the Bank of Anthos `skaffold.yaml`, the `db` module defines\n database deployments: \n\n apiVersion: skaffold/v3\n kind: Config\n metadata:\n name: db # module defining database deployments\n requires:\n - configs:\n - setup\n build:\n artifacts:\n - image: accounts-db\n context: src/accounts-db\n - image: ledger-db\n context: src/ledger-db\n manifests:\n rawYaml:\n - dev-kubernetes-manifests/accounts-db.yaml\n - dev-kubernetes-manifests/ledger-db.yaml\n deploy:\n kubectl: {}\n\n4. For configurations that rely on another configuration being deployed before\n the current configuration can be deployed, you must add the config to your\n dependencies. To specify a config dependency, add a `configs` list to the\n `requires` section of your `skaffold.yaml` file.\n\n For example, the Bank of Anthos `skaffold.yaml` file includes the\n configuration dependency `setup`.\n\n To define a dependency, add the following to your `skaffold.yaml` file where\n \u003cvar translate=\"no\"\u003eDEPENDENCY_NAME\u003c/var\u003e is the name of your dependency. \n\n requires:\n - configs: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eDEPENDENCY_NAME\u003c/span\u003e\u003c/var\u003e\n\n Configurations listed this way can reference dependencies defined in the\n same file or other `skaffold.yaml` files in the current project.\n5. Test your configuration dependencies by building each of the Skaffold\n modules separately to make sure that they're deployed with their\n dependencies by following the steps in\n [Build specific Skaffold modules and their dependencies](#build_skaffold_modules).\n\n### Build specific Skaffold modules and their dependencies\n\nAfter you've defined your modules and their dependencies, you can specify which modules you want to run in the **Build / Deploy** tab when you select **Run** \\\u003e **Edit configurations** .\n\n\u003cbr /\u003e\n\n| **Note:** If a Skaffold project has no modules, including older Skaffold configurations, no additional configuration is required and only the **Build and\n| deploy with all dependencies** option is available.\n\n1. Install the latest [Insiders builds](/code/docs/intellij/insiders#get).\n\n2. Go to **Run** \\\u003e **Edit configurations** and open the **Build / Deploy** tab.\n\n3. For **Skaffold configuration**, select skaffold.yaml.\n\n Choose one of the following:\n - **Build and deploy with all modules and dependencies**\n - **Build and deploy with** (if modules are available) and select the modules you want to build and deploy.\n\nYour selection persists for subsequent deployments. If you select a subset of\nmodules, Cloud Code displays a warning about deploying a subset\nof modules and not the whole system.\n\nContinuous development on Kubernetes\n------------------------------------\n\nOnce you have configured your run target with the options you want, you can\neither opt for a regular run of your application or start a development\niteration cycle on your IDE to propagate any changes made to your source and\ndependencies to your live application.\n\nThe **Develop on Kubernetes** run target starts the development cycle on your\nKubernetes cluster. After you start the development cycle,\nCloud Code, using [Skaffold](/skaffold), builds an image for the\nproject, and then tags it, pushes it to the configured repository, and uses\nkubectl to deploy the project Kubernetes manifests.\n\n1. Click the **Develop on Kubernetes** icon and then click **Edit Configurations** to open the **Run/Debug Configurations** dialog.\n2. Customize your deployment using the [available configuration options](/code/docs/intellij/k8s-overview#customize_your_launch_configuration).\n3. If you want Cloud Code to redeploy your application automatically after your changes are saved, under **Watch mode - rebuild and\n redeploy** , select **On file save** . New Kubernetes applications have **On demand** selected by default. For more information about watch modes, see [Watch modes](/code/docs/intellij/watch-modes).\n4. If your application is configured to use [Skaffold modules](/code/docs/intellij/skaffold-modules), you can [select to only build or deploy specific modules](#build_skaffold_modules).\n5. After you're satisfied with your configuration, click **OK** and then click the **Run** icon.\n\nWhat's next\n-----------\n\n- Use Cloud Code's built in [minikube cluster](/code/docs/intellij/minikube-local-development) for local development.\n- [Debug your application in Cloud Code](/code/docs/intellij/debug)\n- Read the details on [Skaffold's file sync feature](https://skaffold.dev/docs/filesync/)\n\nGet support\n-----------\n\nTo submit feedback or report an issue in your IntelliJ IDE, go to **Tools** \\\u003e **Cloud Code** \\\u003e **Help / About** \\\u003e **Submit\nfeedback or report an issue** to report an issue on [GitHub](https://github.com/GoogleCloudPlatform/cloud-code-intellij/issues)."]]