Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Microservices with Istio, JHipster and Kubernetes - CodeMotion Berlin 2019

Microservices with Istio, JHipster and Kubernetes - CodeMotion Berlin 2019

Istio service mesh is one of the coolest kids on the block. It moves the responsibility of service discovery, load balancing, circuit breaking, monitoring, and so on from the application to the platform (Kubernetes), enabling developers to focus on the business code. But setting it up can be a daunting task for beginners and pros alike. This is where JHipster steps in and makes everything a cakewalk. JHipster is a widely used OSS application development platform for creating web applications and microservices in minutes. In this session, you’ll learn how to create a production-grade Java microservice architecture with Spring Boot, Istio, Docker, Kubernetes, and JHipster and deploy it to the cloud in under 30 minutes. As a bonus, you’ll learn how Istio works in the process.


Deepu K Sasidharan

November 12, 2019


  1. Microservices with Istio, JHipster and Kubernetes Deepu K Sasidharan @deepu105

    | deepu.tech 12-13 November, 2019
  2. https://jhipster.tech #CodemotionBerlin2019 @java_hipster About me Deepu K Sasidharan JHipster co-lead

    developer Developer @ XebiaLabs OSS aficionado, author, speaker @deepu105 deepu.tech deepu105
  3. https://jhipster.tech #CodemotionBerlin2019 @java_hipster What about you? How many are Java

    web app developers? How many of you are doing microservices? Are there any cloud native developers? Are you a fan of Kubernetes? Have you tried Istio or Linkerd? Have you tried JHipster?
  4. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Cloud Native Microservices with Istio service mesh

  5. https://jhipster.tech #CodemotionBerlin2019 @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
  6. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Istio architecture

  7. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Demo time Blog post available at bit.ly/istio-k8s

  8. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Prerequisite - Cluster Create GCP Project :

    $ gcloud projects create jhipster-demo - Enable billing and Kubernetes Engine API $ gcloud config set project jhipster-demo Create GKE Cluster : $ gcloud container clusters create hello-hipster \ --cluster-version 1.13 \ --num-nodes 4 \ --machine-type n1-standard-2 Set Credentials: $ gcloud container clusters get-credentials hello-hipster
  9. https://jhipster.tech #CodemotionBerlin2019 @java_hipster GKE Cluster

  10. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Prerequisite - Istio Install Istio : $

    cd ~/ $ export ISTIO_VERSION=1.3.0 $ curl -L https://git.io/getLatestIstio | sh - $ ln -sf istio-$ISTIO_VERSION istio $ export PATH=~/istio/bin:$PATH
  11. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Prerequisite - Istio Install Istio in GKE

    cluster : $ kubectl create clusterrolebinding cluster-admin-binding \ --clusterrole=cluster-admin \ --user="$(gcloud config get-value core/account)" $ kubectl create namespace istio-system $ cd ~/istio-$ISTIO_VERSION $ helm template install/kubernetes/helm/istio-init --name istio-init --namespace istio-system | kubectl apply -f - $ helm template install/kubernetes/helm/istio --name istio --namespace istio-system \ --values install/kubernetes/helm/istio/values-istio-demo.yaml | kubectl apply -f - Get Ingress Gateway IP: $ kubectl get svc istio-ingressgateway -n istio-system
  12. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Istio pods

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

  14. https://jhipster.tech #CodemotionBerlin2019 @java_hipster How can we bootstrap this quickly?

  15. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Enter JHipster Most popular Rapid Application Development

    platform for Java web applications and microservices ▪ 15k+ stars, 25k projects and 500+ contributors on GitHub ▪ 2M+ installations & 20k+ app generations per month ▪ 250k+ overall users ▪ 300+ companies using JHipster ▪ 70+ plugins
  16. https://jhipster.tech #CodemotionBerlin2019 @java_hipster What can you do with JHipster?

  17. https://jhipster.tech #CodemotionBerlin2019 @java_hipster • World peace! • Fix your plumbing

    • Order Pizza for you
  18. https://jhipster.tech #CodemotionBerlin2019 @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, Azure, Heroku, Cloud Foundry ▪ Deploy to Docker, Kubernetes, Openshift
  19. https://jhipster.tech #CodemotionBerlin2019 @java_hipster JDL Application

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

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

  22. https://jhipster.tech #CodemotionBerlin2019 @java_hipster JDL JHipster Domain Language JDL : http://bit.ly/istio-jdl

    Reference : https://www.jhipster.tech/jdl/ Studio : https://start.jhipster.tech/jdl-studio/
  23. https://jhipster.tech #CodemotionBerlin2019 @java_hipster JHipster magic $ jhipster import-jdl app.jdl

  24. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Build & Push images $ ./gradlew bootJar

    -Pprod jibBuild -Djib.to.image=deepu105/store $ ./gradlew bootJar -Pprod jibBuild -Djib.to.image=deepu105/product $ ./gradlew bootJar -Pprod jibBuild -Djib.to.image=deepu105/invoice $ ./gradlew bootJar -Pprod jibBuild -Djib.to.image=deepu105/notification
  25. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Deploy to GKE $ cd kubernetes $

    ./kubectl-apply.sh $ watch kubectl get pods -n jhipster
  26. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Gateway

  27. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Telemetry

  28. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Prometheus dashboard 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
  29. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Prometheus dashboard

  30. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Grafana dashboard

  31. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Jaeger tracing

  32. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Kiali

  33. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Is it worth the hype? + Kubernetes

    Native microservices + Reduced responsibilities for dev(Service discovery, security, telemetry, 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
  34. https://jhipster.tech #CodemotionBerlin2019 @java_hipster What can 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 • And more...
  35. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Thank you Do rate the talk if

    you found it useful!
  36. https://jhipster.tech #CodemotionBerlin2019 @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
  37. https://jhipster.tech #CodemotionBerlin2019 @java_hipster Other Microservices architecture options

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

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

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

  41. https://jhipster.tech #CodemotionBerlin2019 @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)
  42. https://jhipster.tech #CodemotionBerlin2019 @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