Skip to content

Spring Kubernetes Microservice example

Notifications You must be signed in to change notification settings

gase-tech/microservices

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Kubernetes Example

Example Spring cloud kubernetes project. Run in local&kubernetes environment.

Compile Projects

You can compile projects via:

Local Development:

You need docker up and running in local environment.

  1. Before Running apps from you favorite IDE apply configs in local kube env
    $ bash build.sh apply-config-k8
    You can remove config via
    $ bash build.sh remove-config-k8
  2. Check applications on local environment
    1. Address Endpoint
      $ curl http://localhost:8081/address/1
    2. User Endpoint which calls address domain
      $ curl http://localhost:8080/users/1
    3. Get environment configs
      $ curl http://localhost:8080/config

Kubernetes:

Please check ingress for kubernetes environment. Check Adding Ingress

  1. Compile project and build docker images
    $ bash build.sh compile
  2. Start Kubernetes deployments, services and ingress
    $ bash build.sh start-k8
  3. Stop Kubernetes deployments, services and ingress
    $ bash build.sh stop-k8
  4. Check applications on kubernetes
    1. Address Endpoint
      $ curl http://localhost:31001/address/1
    2. User Endpoint which calls address domain
      $ curl http://localhost:31000/users/1
    3. Get environment configs
      $ curl http://localhost:31000/config
  5. Access via Ingress
    1. Address Endpoint
      $ curl http://localhost/address-api/address/1
    2. User Endpoint which calls address domain
      $ curl http://localhost/user-api/users/1
    3. Get environment configs
      $ curl http://localhost/user-api/config

Add Ingress

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 Versions

Cli Version
docker 20.10.5
docker desktop kubernetes v1.19.7
mvn 3.8.1

Deadline gif

About

Spring Kubernetes Microservice example

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 87.3%
  • Shell 11.5%
  • Dockerfile 1.2%