Slide 1

Slide 1 text

JHipster Microservices with Spring boot 2 and Kubernetes Deepu K Sasidharan @deepu105 deepu.js.org

Slide 2

Slide 2 text

https://jhipster.tech #DevoxxMa @java_hipster About me Deepu K Sasidharan JHipster co-lead developer Senior product developer @ XebiaLabs OSS aficionado, author, speaker @deepu105 deepu.js.org

Slide 3

Slide 3 text

https://jhipster.tech #DevoxxMa @java_hipster XebiaLabs dev test uat prod [Cloud] Orchestration Stack Middleware NoSQL PaaS Containers OS OS OS IaaS Network Servers DB / Storage Security SOFTWARE DEFINED DATA CENTER / CLOUD RELEASE ORCHESTRATION Backlog Management Provisioning/ Configuration Security ITSM / Service Management CMDB plan Project Management Issue Tracking ALM DEPLOYMENT AUTOMATION code SCM Code Analysis build Continuous Integration Centralized Repository test Test Tooling Test Visualization release ChatOps / Collaboration Email/ phone/ Excel operate BI / Monitoring Logging DEVOPS INTELLIGENCE

Slide 4

Slide 4 text

https://jhipster.tech #DevoxxMa @java_hipster About JHipster Most popular Rapid Application Development platform for Java web applications and microservices ▪ 12k+ stars on GitHub ▪ 1.5M+ installations & 20k+ app generations per month ▪ 250k+ overall users ▪ 460+ contributors & 24 core team members ▪ 260+ companies using JHipster ▪ 70+ plugins

Slide 5

Slide 5 text

https://jhipster.tech #DevoxxMa @java_hipster What can you do with JHipster? ▪ Generate simple monolith web applications ▪ Generate complete microservice architectures ▪ Generate domain model (entities) ▪ Generate CI/CD pipelines ▪ Deploy to AWS, GCP, Heroku, Cloud Foundry ▪ Deploy to Docker, Kubernetes, Openshift, Rancher

Slide 6

Slide 6 text

https://jhipster.tech #DevoxxMa @java_hipster Is it some junk generated code?

Slide 7

Slide 7 text

https://jhipster.tech #DevoxxMa @java_hipster What’s new? JHipster 5 and beyond!

Slide 8

Slide 8 text

https://jhipster.tech #DevoxxMa @java_hipster JHipster 5 and beyond ● React ● Angular 7 ● VueJS ● Webpack 4 ● Jest ● Prettier ● Spring Boot 2.x ● Micrometer ● Heroku + AWS + GAE + Azure ● Istio ● Blueprints ● JDL 3 (application & deployment via JDL)

Slide 9

Slide 9 text

https://jhipster.tech #DevoxxMa @java_hipster Spring Boot 2.x ● Migration to Spring Boot 2.0 complete ○ Another good reason to use JHipster! ● Work is under way for reactive programming support ○ Test it by running “jhipster --experimental” ○ Still work to do on entities and on the client-side ● Migration to Spring Boot 2.1 has started ○ JDK 11 support ○ We are waiting for Spring Cloud to support Spring Boot 2.1

Slide 10

Slide 10 text

https://jhipster.tech #DevoxxMa @java_hipster Microservices with Netflix OSS Stack

Slide 11

Slide 11 text

https://jhipster.tech #DevoxxMa @java_hipster Netflix OSS Eureka Service registry for service discovery and mid-tier load balancing. Ribbon Load balancing, fault tolerance, caching & batching. Hystrix Circuit breaking and fault tolerance Zuul Edge service(Routing, Load balancing, monitoring, security and more)

Slide 12

Slide 12 text

https://jhipster.tech #DevoxxMa @java_hipster JHipster Registry Eureka server Provides service discovery Spring cloud config server Provides runtime configurations Administration server Monitoring, logs, configurations and dashboards Spring Boot Provides the application runtime

Slide 13

Slide 13 text

https://jhipster.tech #DevoxxMa @java_hipster Microservice with JHipster Registry

Slide 14

Slide 14 text

https://jhipster.tech #DevoxxMa @java_hipster JDL Application

Slide 15

Slide 15 text

https://jhipster.tech #DevoxxMa @java_hipster JDL Entity & Relationship

Slide 16

Slide 16 text

https://jhipster.tech #DevoxxMa @java_hipster JDL Deployment for docker compose

Slide 17

Slide 17 text

https://jhipster.tech #DevoxxMa @java_hipster JDL JHipster Domain Language JDL : http://bit.ly/devoxx-ma-jdl-1 Reference : https://www.jhipster.tech/jdl/ Studio : https://start.jhipster.tech/jdl-studio/

Slide 18

Slide 18 text

https://jhipster.tech #DevoxxMa @java_hipster JHipster magic $ jhipster import-jdl app.jdl

Slide 19

Slide 19 text

https://jhipster.tech #DevoxxMa @java_hipster Prerequisite - Cluster (GKE) Create GCP Project : $ gcloud projects create jhipster-demo $ gcloud config set project jhipster-demo Create GKE Cluster : $ gcloud container clusters create hello-hipster \ --cluster-version 1.10 \ --num-nodes 4 \ --machine-type n1-standard-2 Set Credentials: $ gcloud container clusters get-credentials hello-hipster

Slide 20

Slide 20 text

https://jhipster.tech #DevoxxMa @java_hipster GKE Cluster

Slide 21

Slide 21 text

https://jhipster.tech #DevoxxMa @java_hipster Deploy to GKE $ cd kubernetes $ ./kubectl-apply.sh $ watch kubectl get pods -n jhipster $ kubectl get services -n jhipster

Slide 22

Slide 22 text

https://jhipster.tech #DevoxxMa @java_hipster Gateway

Slide 23

Slide 23 text

https://jhipster.tech #DevoxxMa @java_hipster Expose the Registry Create a load balancer: $ kubectl expose service jhipster-registry --type=LoadBalancer \ --name=exposed-registry -n jhipster Get the public IP : $ kubectl get service exposed-registry -n jhipster

Slide 24

Slide 24 text

https://jhipster.tech #DevoxxMa @java_hipster JHipster Registry

Slide 25

Slide 25 text

https://jhipster.tech #DevoxxMa @java_hipster JHipster Console

Slide 26

Slide 26 text

https://jhipster.tech #DevoxxMa @java_hipster Microservices with Istio service mesh

Slide 27

Slide 27 text

https://jhipster.tech #DevoxxMa @java_hipster What does Istio do? ● Service discovery  ● Automatic load balancing  ● Routing, circuit breaking, retries, fail-overs, fault injection ● Policy enforcement for access control, rate limiting, A/B testing, traffic splits, and quotas ● Metrics, logs, and traces  ● Secure service-to-service communication

Slide 28

Slide 28 text

https://jhipster.tech #DevoxxMa @java_hipster Istio architecture

Slide 29

Slide 29 text

https://jhipster.tech #DevoxxMa @java_hipster Prerequisite - Istio Install Istio : $ cd ~/ $ export ISTIO_VERSION=1.0.2 $ curl -L https://git.io/getLatestIstio | sh - $ ln -sf istio-$ISTIO_VERSION istio $ export PATH=~/istio/bin:$PATH Install Istio in GKE cluster : $ kubectl apply -f ~/istio/install/kubernetes/helm/istio/templates/crds.yaml $ kubectl apply -f ~/istio/install/kubernetes/istio-demo.yaml \ --as=admin --as-group=system:masters Get Ingress Gateway IP: $ kubectl get svc istio-ingressgateway -n istio-system

Slide 30

Slide 30 text

https://jhipster.tech #DevoxxMa @java_hipster Istio pods

Slide 31

Slide 31 text

https://jhipster.tech #DevoxxMa @java_hipster Microservice with Istio on Kubernetes

Slide 32

Slide 32 text

https://jhipster.tech #DevoxxMa @java_hipster JDL Application

Slide 33

Slide 33 text

https://jhipster.tech #DevoxxMa @java_hipster JDL Deployment for Kubernetes with Istio

Slide 34

Slide 34 text

https://jhipster.tech #DevoxxMa @java_hipster JDL JHipster Domain Language JDL : http://bit.ly/devoxx-ma-jdl-2 Reference : https://www.jhipster.tech/jdl/ Studio : https://start.jhipster.tech/jdl-studio/

Slide 35

Slide 35 text

https://jhipster.tech #DevoxxMa @java_hipster JHipster magic $ jhipster import-jdl app.jdl

Slide 36

Slide 36 text

https://jhipster.tech #DevoxxMa @java_hipster Deploy to GKE $ cd kubernetes $ ./kubectl-apply.sh $ watch kubectl get pods -n jhipster

Slide 37

Slide 37 text

https://jhipster.tech #DevoxxMa @java_hipster Exploring the app Application Gateway: $ export INGRESS_IP=$(kubectl -n istio-system get svc istio-ingressgateway \ -o jsonpath='{.status.loadBalancer.ingress[0].ip}') $ google-chrome store.$INGRESS_IP.nip.io

Slide 38

Slide 38 text

https://jhipster.tech #DevoxxMa @java_hipster Monitoring & logs Grafana - Monitoring dashboard: $ kubectl -n istio-system port-forward $(kubectl -n istio-system get pod \ -l app=grafana -o jsonpath='{.items[0].metadata.name}') 3000:3000 $ google-chrome http://localhost:3000 Prometheus - Log metrics: $ kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l \ app=prometheus -o jsonpath='{.items[0].metadata.name}') 9090:9090 $ google-chrome http://localhost:9090

Slide 39

Slide 39 text

https://jhipster.tech #DevoxxMa @java_hipster Grafana dashboard

Slide 40

Slide 40 text

https://jhipster.tech #DevoxxMa @java_hipster Prometheus dashboard

Slide 41

Slide 41 text

https://jhipster.tech #DevoxxMa @java_hipster Observability Jaeger - Distributed tracing: $ kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l \ app=jaeger -o jsonpath='{.items[0].metadata.name}') 16686:16686 $ google-chrome http://localhost:16686 Service graph: $ kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l \ app=servicegraph -o jsonpath='{.items[0].metadata.name}') 8088:8088 $ google-chrome http://localhost:8088/force/forcegraph.html

Slide 42

Slide 42 text

https://jhipster.tech #DevoxxMa @java_hipster Jaeger tracing

Slide 43

Slide 43 text

https://jhipster.tech #DevoxxMa @java_hipster Service graph

Slide 44

Slide 44 text

https://jhipster.tech #DevoxxMa @java_hipster Is it worth the hype? + Kubernetes Native microservices + Reduced responsibilities(Service discovery, security, tracing, etc) + No need to write/maintain any code for some of the complex parts of a microservice architecture. + A/B testing, canary releases, and lot more - New compared to other stable options - Higher resource usage (CPU, Memory) - Higher running costs - Business logic related policies might be trickier

Slide 45

Slide 45 text

https://jhipster.tech #DevoxxMa @java_hipster Other Microservices architecture options

Slide 46

Slide 46 text

https://jhipster.tech #DevoxxMa @java_hipster Microservice with Consul

Slide 47

Slide 47 text

https://jhipster.tech #DevoxxMa @java_hipster Microservice with Consul & Traefik

Slide 48

Slide 48 text

https://jhipster.tech #DevoxxMa @java_hipster Main website https://jhipster.tech JHipster online https://start.jhipster.tech GitHub https://github.com/jhipster/generator-jhipster Twitter https://twitter.com/java_hipster Stack Overflow https://stackoverflow.com/questions/tagged/jhipster?sort=newest More information on JHipster

Slide 49

Slide 49 text

https://jhipster.tech #DevoxxMa @java_hipster Thank you Do rate the talk if you found it useful!