This Helm chart deploys the Spring Petclinic application with a PostgreSQL database onto a local Kubernetes cluster (Minikube/kind).
- Spring Boot app deployed as a
Deployment - PostgreSQL database as a
StatefulSet - Secrets for DB credentials
- ConfigMap for DB config
- Internal
ClusterIPservices for app and DB - Optional Ingress setup (see how to enable ➜)
To run this project locally, make sure you have the following tools installed:
- Docker – for building the application image
- kubectl – Kubernetes CLI
- Helm – for managing Helm charts
- A local Kubernetes cluster (any of the following):
- Minikube
- Docker Desktop with Kubernetes enabled
Optional for Windows users:
- Docker is installed and running
- Kubernetes cluster is up (Minikube, Docker Desktop, etc.)
-
kubectlis installed and configured -
helmis installed
This chart uses a Kubernetes Secret to store the database credentials.
By default, credentials are defined in values.yaml. You can customize them directly in that file:
database:
username: petclinic
password: petclinicThere are two ways to install this chart locally:
-
Make sure your local K8s cluster is running (e.g. Minikube or Docker Desktop).
-
(Optional) Verify you're using the correct Kubernetes context:
kubectl config current-context
kubectl config use-context docker-desktop # or minikube- Build the Docker image locally:
docker build -t spring-petclinic:latest .- Deploy with Helm:
helm upgrade --install petclinic ./petclinic-chart- Optionally enable ingress in
values.yamland add a local DNS entry forpetclinic.local. (see how to enable)
💡 Note: deploy.sh is a Unix shell script and requires a Unix-compatible environment (Linux, macOS, or WSL on Windows).
You can use the provided deploy.sh script to automate the full setup:
./deploy.sh [custom-port]- If no port is specified, the script defaults to
8080 - You can run
./deploy.sh 9090to use port9090instead
This script builds the Docker image, installs the Helm chart, and port-forwards the app.
- Check Pods:
kubectl get pods- Port forward to access app (if not using
deploy.sh):
kubectl port-forward svc/petclinic 8080:8080
open https://localhost:8080- Update
values.yamlto enable ingress:
ingress:
enabled: false
className: ""
annotations: {}
hosts:
- host: petclinic.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []- Enable ingress controller:
- On Minikube:
minikube addons enable ingress - On Docker Desktop: Enable Kubernetes ingress in settings.
- Add a local DNS entry:
- Linux/macOS: Edit
/etc/hosts127.0.0.1 petclinic.local - Windows: Edit
C:\Windows\System32\drivers\etc\hostsas Administrator:127.0.0.1 petclinic.local
- Access your app:
https://petclinic.local