{"id":21877634,"url":"https://github.com/rbiedrawa/spring-k8s-workshop","last_synced_at":"2026-04-12T18:02:45.147Z","repository":{"id":162193119,"uuid":"354507370","full_name":"rbiedrawa/spring-k8s-workshop","owner":"rbiedrawa","description":"Workshop: Local Kubernetes Development with Java/Spring Boot application.","archived":false,"fork":false,"pushed_at":"2022-01-31T02:07:29.000Z","size":566,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-26T18:17:20.274Z","etag":null,"topics":["cloud-code","debugging-tools","graceful-shutdown","k8s","k8s-deployment","k9s","kubernetes","kubernetes-deployments","live-reload","liveness-probe","logging","logstash","micrometer","prometheus-metrics","readiness-probe","skaffold","skaffold-example","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rbiedrawa.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-04T09:47:07.000Z","updated_at":"2021-12-27T12:27:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"b409c6f8-8329-4012-a3e2-28f7be43aa35","html_url":"https://github.com/rbiedrawa/spring-k8s-workshop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbiedrawa%2Fspring-k8s-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbiedrawa%2Fspring-k8s-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbiedrawa%2Fspring-k8s-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbiedrawa%2Fspring-k8s-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rbiedrawa","download_url":"https://codeload.github.com/rbiedrawa/spring-k8s-workshop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244885518,"owners_count":20526293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-code","debugging-tools","graceful-shutdown","k8s","k8s-deployment","k9s","kubernetes","kubernetes-deployments","live-reload","liveness-probe","logging","logstash","micrometer","prometheus-metrics","readiness-probe","skaffold","skaffold-example","spring-boot"],"created_at":"2024-11-28T08:09:49.727Z","updated_at":"2025-09-18T16:32:31.080Z","avatar_url":"https://github.com/rbiedrawa.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Local Kubernetes Development with Java/Spring Boot application (Workshop)\n\nThis repository contains sample Spring Boot application, k8s definitions and scaffold setup.\n\n## What You will learn\n\n* How to set up **Readiness** and **liveness** probes.\n* How to wait for container lifecycle processes to finish.\n* How to enable **graceful shutdown**.\n* How to expose metrics.\n* How to configure **logstash-logback-encoder**.\n* How to **debug** application running inside k8s.\n* How to use **live-reload** feature for faster development.\n* How to use common kubectl commands and generate k8s definitions.  \n* How to use **Skaffold** for local Kubernetes development.\n* How to use **Cloud Code** plugin in IntelliJ.\n\n## Getting Started\n\n### Prerequisites\n\n* Java 11\n* Docker\n* Kubernetes\n\n### Installation\n\nBuild docker image.\n```shell\n./gradlew bootBuildImage\n```\n\n### Usage\n\n#### Kubectl\n\n* Apply k8s configurations files from a directory.\n  ```shell\n  kubectl create -f k8s/namespace.yml\n  kubectl apply -f k8s/\n  ```\n* Port forward *spring-k8s-workshop* service.\n  ```shell\n  kubectl port-forward svc/spring-k8s-workshop 8080:8080\n  ```\n* Visit http://localhost:8080/hello resource.\n\n* Play with kubectl api, see section 'Additional Useful Commands'.\n\n* [Optionally] Install and play with **k9s** tool (https://github.com/derailed/k9s).\n  ![k9s.png](./_docs/img/k9s.png)\n\n* Destroy all *spring-k8s-workshop* components.\n  ```shell\n  kubectl delete all --all -n spring-k8s-workshop\n  kubectl delete ns spring-k8s-workshop\n  ```\n\n#### Skaffold\n\n* Run a pipeline in development mode.\n    ```shell\n    skaffold dev --port-forward\n    ```\n    *** **--port-froward** - expose ports. \n  \n    *** **--trigger=manual** - disable auto-build (triggered after file change). Allowed values polling, notify, manual.\n  \n* Visit http://localhost:8080/hello resource.\n  \n* Make some changes inside HelloController class to see *live reload* feature.\n  \n* Stop skaffold dev (`CTRL + C`).\n  \n* Run skaffold in debug mode.\n    ```shell\n    # Similar to `dev`, but configures the pipeline for debugging. Auto-build and sync is disabled by default to prevent\n    # accidentally tearing down debug sessions.\n    skaffold debug --port-forward\n    ```\n* Configure remote debugging in Intellij Idea.\n  ![intellij-skaffold-remote-debug-setup.png](./_docs/img/intellij-skaffold-remote-debug-setup.png)\n  \n* Start Debug session in Intellij Idea and create breakpoint inside HelloController.class \n\n#### Cloud Code\n\n* Watch this amazing Google Cloud Tech introduction how to use plugin - [Cloud-native development in the IDE with Cloud Code](https://www.youtube.com/watch?v=g9gIgiNsRgg).\n  \n* Install **Cloud Code** plugin from https://plugins.jetbrains.com/plugin/8079-cloud-code.\n  \n* Play again with sample application this time using **Cloud Code** plugin;)\n  ![cloud-code-plugin.png](./_docs/img/cloud-code-plugin.png)\n  \n\n## Additional Useful Commands\n\n**Create k8s definitions using --dry-run.**\n```shell\n# Create secret definition\nkubectl create secret generic spring-k8s-workshop-secret --dry-run=client -o=yaml \u003e secret.yaml\n\n# Creating deployment definition\nkubectl create deployment deployment_name --image=spring-k8s-workshop:0.0.1-SNAPSHOT --dry-run=client -o=yaml \u003e deployment.yaml\n\n# Create Service definition\nkubectl create service clusterip spring-k8s-workshop --tcp=8080:8080 --dry-run=client  -o=yaml \u003e\u003e service.yaml\n\n# Create config map from yml file\nkubectl create configmap --dry-run somename --from-file=./src/main/resources/application-dev.yml -o=yaml\n```\n\n**Create Secret.**\n```shell\n# Create secret and base64 encode it\necho -n \"Secret from k8s\" | base64\n\n# Create secret, base64 encode it and add it to your clipboard\necho -n \"Secret from k8s\" | base64 | pbcopy\n```\n\n## References\n\n* [Spring on Kubernetes](https://spring.io/guides/topicals/spring-on-kubernetes/)\n* [Spring configtree](https://docs.spring.io/spring-boot/docs/2.4.3/reference/htmlsingle/#boot-features-external-config-files-configtree)\n* [Skaffold - Local Kubernetes Development Made Easy](https://www.youtube.com/watch?v=tTNrzEjROCo)\n* [Skaffold - Github releases](https://github.com/GoogleContainerTools/skaffold/releases)\n* [Google Cloud - Cloud Code](https://cloud.google.com/code)\n* [Cloud-native development in the IDE with Cloud Code](https://www.youtube.com/watch?v=g9gIgiNsRgg)\n* [Best Practices to Spring to Kubernetes Easier and Faster by Ray Tsang](https://www.youtube.com/watch?v=c16oOeTfFXM)\n* [k9s](https://github.com/derailed/k9s)\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbiedrawa%2Fspring-k8s-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frbiedrawa%2Fspring-k8s-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbiedrawa%2Fspring-k8s-workshop/lists"}