Example Spring cloud kubernetes project. Run in local&kubernetes environment.
You can compile projects via:
You need docker up and running in local environment.
- Before Running apps from you favorite IDE apply configs in local kube env
You can remove config via
$ bash build.sh apply-config-k8
$ bash build.sh remove-config-k8
- Check applications on local environment
- Address Endpoint
$ curl http://localhost:8081/address/1
- User Endpoint which calls address domain
$ curl http://localhost:8080/users/1
- Get environment configs
$ curl http://localhost:8080/config
- Address Endpoint
Please check ingress for kubernetes environment. Check Adding Ingress
- Compile project and build docker images
$ bash build.sh compile
- Start Kubernetes deployments, services and ingress
$ bash build.sh start-k8
- Scale Kubernetes deployments
$ bash build.sh start-k8 scale=2
- Stop Kubernetes deployments, services and ingress
$ bash build.sh stop-k8
- Check applications on kubernetes
- Address Endpoint
$ curl http://localhost:31001/address/1
- User Endpoint which calls address domain
$ curl http://localhost:31000/users/1
- Get environment configs
$ curl http://localhost:31000/config
- Address Endpoint
- Access via Ingress
- Address Endpoint
$ curl http://localhost/address-api/address/1
- User Endpoint which calls address domain
$ curl http://localhost/user-api/users/1
- Get environment configs
$ curl http://localhost/user-api/config
- Address Endpoint
- Update Configuration
- Update configuration file in user-docker config and refresh actuator via endpoint.
$ curl -X POST http://localhost/user-api/actuator/refresh
Please read documentation for adding ingress if you are not using mac https://kubernetes.github.io/ingress-nginx/deploy/#docker-for-mac
This command add ingress to your docker desktop kubernetes.
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.46.0/deploy/static/provider/cloud/deploy.yaml
Cli | Version |
---|---|
docker | 20.10.5 |
docker desktop kubernetes | v1.19.7 |
mvn | 3.8.1 |