docker 19.03.1
windows 10
helm v2.16.3+g1ee0254
minikube = v0.28.2 (localkube bootstrapper)
kubectl = v1.10.0
Note: build and verify can be automated using Makefile
1. minikube start
$ minikube start --bootstrapper=localkube
$ minikube docker-env
$ eval $(minikube docker-env)
2. project folder
docker-spring-boot
|_ Dockerfile
|_ docker-compose.yaml
|_ settings.xml
|_ charts
|_ springboot-demo
|_ Chart.yaml
|_ values.yaml
|_ templates
|_ deployment.yaml
|_ ingress.yaml
|_ service.yaml
|_ Makefile
|_ src
|_ main/java/com.demo/SpringBootAppDemo.java
|_ pom.xml
3. insecure-registries
$ minikube ip
192.168.99.214$ vim C:\Users\my\.minikube\machines\minikube\config.json
"InsecureRegistry": [
"192.168.99.0/24"
]
4. docker registry:2.6.2
$ docker run -d \
--restart=always \
-e REGISTRY_HTTP_ADDR=0.0.0.0:5002 \
-p 5002:5002 \
--name registry \
registry:2.6.2
5. build and verify
$ mvn clean install -gs ./settings.xml
target/docker-spring-boot.jar$ docker build -t demotest:latest .$ docker tag demotest:latest 192.168.99.214:5002/demotest:latest$ docker push 192.168.99.214:5002/demotest:latest$ curl -k http://192.168.99.214:5002/v2/_catalog
6. docker-run
$ docker run -di 192.168.99.214:5002/demotest:latest -p 8085:8085$ curl http://192.168.99.214:8085/rest/docker/hello
hello
OR
7. helm deploy
$ cd docker-spring-boots/charts$ helm install -n spring-demo spring-boot-demo/NAME: spring-demo
LAST DEPLOYED: Fri Jul 10 03:26:49 2020
NAMESPACE: default
STATUS: DEPLOYEDRESOURCES:
==> v1/Pod(related)
NAME AGE
amber-prawn-springboot-demo-74cc654c9b-4q48s 0s==> v1/Service
NAME AGE
amber-prawn-springboot-demo 0s==> v1beta1/Deployment
NAME AGE
amber-prawn-springboot-demo 0sNOTES:
1. Get the application URL by running these commands:
export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services amber-prawn-springboot-demo) export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT$ curl http://$NODE_IP:$NODE_PORT/rest/docker/hello
link will provided soon for the github page ..
Jenkinsfile will be added soon for doing integration tests seamlessly….
readiness and liveness probe to be added yet in template files for SpringBoot ….
thats’ all folks take it easy