- Create postgres pod, service and persistent volume with configuration
postgres.yaml
:
kubectl create -f kube/postgres.yaml
- Package application into jar:
./gradlew clean build
- Create image of application:
docker build -t docker-boot .
- Create pod with deployment config for spring boot application with configuration
sp-deployment.yaml
:
kubectl create -f kube/sp-deployment.yaml
- Expose service for created deployment
kube-boot
:kubectl expose deployment kube-boot --type=LoadBalancer --port=8080
- Get external url of
kube-boot
service:minikube service docker-boot --url
- Copy url with port that you get on previous stage and insert it in browser. You should see
Hello World! profile: prod
If your pod didn't start and stay in status ErrImagePull
, then execute in terminal eval $(minikube docker-env)
.
This command will point your docker client to your machine's docker daemon. To undo that execute eval $(minikube docker-env -u)
.
To check logs of starting of your spring boot, get your pod name from your cluster(ex. kube-boot-697fdf6ff4-jb6qc
) and execute command kubectl logs <YOUR_POD_NAME>