This is example of single Spring boot application deployment running behind NodePort service.
$ git clone https://github.com/thenswan/spring-boot-k8s-samples.git
$ cd spring-boot-k8s-samples/alpha
$ ./deploy-to-k8s.sh
- Build java .jar file
- Build docker image
- Create kubernetes deployment
- Create kubernetes service
$ cd spring-boot-k8s-samples/alpha
$ ./clean-up.sh
- Remove built java .jar file
- Remove docker image
- Remove kubernetes deployment
- Remove kubernetes service
kubectl get svc alpha -o wide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
alpha NodePort 10.105.32.21 <none> 8081:31552/TCP 25s run=alpha
Note that EXTERNAL-IP denoted as <none>
, url in this case will be: localhost:31552/api/alpha/hello
curl host:port/api/alpha/hello
Check out sh files and comments
...are very welcome!