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
Tweet

More Decks by Deepu K Sasidharan

Other Decks in Programming

Transcript

  1. 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
  2. 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?
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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/
  10. 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
  11. 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
  12. 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
  13. 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...
  14. 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
  15. 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)
  16. 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