This repository contains the companion code for the "Kubernetes Made Simple: A Guide for JVM Developers" article, demonstrating how to deploy a Kotlin Spring Boot application to Kubernetes.
This project provides a hands-on, practical example of deploying JVM-based microservices on Kubernetes. It showcases a complete workflow from containerization to deployment, covering essential Kubernetes concepts in a way that's approachable for Java and Kotlin developers.
- Containerization with Docker: A production-ready Dockerfile for packaging Kotlin/Spring Boot applications
- Kubernetes Fundamentals: Working examples of Deployments, Services, and Pods
- Configuration Management: Using ConfigMaps for application settings and Secrets for sensitive data
- Database Integration: PostgreSQL deployment on Kubernetes with persistent storage
- Advanced Routing: Ingress configuration with canary deployments for progressive rollouts
- Kotlin - A modern, expressive JVM language fully interoperable with Java
- Spring Boot - The popular framework for building production-grade applications
- Kubernetes - Container orchestration platform for deploying and managing microservices
- Docker - Containerization platform for packaging applications
- PostgreSQL - Relational database for persistent data storage
- Minikube - Local Kubernetes environment for development and testing
This project demonstrates how Kotlin's concise syntax, null safety, and seamless Spring integration make it an excellent choice for building cloud-native microservices.
-
Build kotlin app
./gradlew clean build
-
Build Docker image (builds the app inside container):
docker build -f Dockerfile -t kotlin-app:latest . -
Deploy to Kubernetes:
kubectl apply -f k8s/deployment.yaml kubectl apply -f k8s/service.yaml
-
Check deployment status:
kubectl get pods kubectl get services
-
Test the application:
minikube service kotlin-app-service
kubectl delete -f k8s/This is the starter version of the tutorial. You can view other versions by navigating to different branches: