Ray Tsang and Matt Raible
Choose Your Own Adventure with JHipster & K8s
@saturnism | @mraible
Are you a Java developer?
Are you a Web developer?
Do you like web frameworks?
Hello, JHipster!
https://jhipster.tech
Application Generator
Development Platform
Popular Open Source Project
Monoliths, Microservices, and Gateways
Who is Ray Tsang?
Developer Advocate at Google Cloud
Kubernetes Enthusiast
JHipster Committer
Backpacker, snowboarder, photographer
@saturnism on Twitter
Who is Matt Raible?
Developer Advocate at Okta
Web Framework Enthusiast
JHipster Committer
Skier, rafter, classic VW fan
@mraible on Twitter
JHipster Gives You Lots of Options
Spring Boot
Spring Security
SQL or NoSQL
Maven or Gradle
Bootstrap
Angular, React, or Vue
End-to-End Tests
Performance Tests
26,000+ options https://arxiv.org/abs/1710.07980
Choose Your Own Adventure
Spring Boot
Google Trends for Spring Boot
The Rest of the Java Pack
Docker
Kubernetes
Monolith vs. Microservice Architecture
Monolith Microservices
Pro Single app to manage
Single CI/CD pipeline
Low latency between calls
Low coupling
Faster build / deploy cycle per service
Easier to scale out individual services
Con Slow build / deploy cycle
High coupling
Harder to scale out
Multiple apps to manage
Multiple CI/CD pipeline
Multiple EVERYTHING!
High latency and issues between calls
Proper service boundary
Monolith
Legacy forever!
At least only one pile of...
Microservices
So you like the difficult stuff?
Unpopular Opinion
"Monoliths are the future because the problem people are trying to solve with
microservices doesn’t really line up with reality."
https://changelog.com/posts/monoliths-are-the-future
Maven or Gradle?
Java, Kotlin, .NET, or Node?
jhipster/jhipster-kotlin
jhipster/jhipster-dotnetcore jhipster/generator-jhipster-nodejs
The End
FYI... Micronaut & Quarkus Support is in development
https://github.com/jhipster/generator-jhipster-micronaut
npm install -g generator-jhipster-micronaut
mhipster
https://github.com/jhipster/jhipster-quarkus
npm install -g generator-jhipster-quarkus
jhipster -d --blueprint quarkus
Which Authentication Type?
Authentication: Session, JWT, or OAuth 2.0?
Because friends don't let friends write authentication!
MySQL, PostgreSQL, or MongoDB?
Spring MVC or Spring WebFlux?
CRUD with WebFlux?
https://github.com/jhipster/generator-jhipster/issues/7608
What do you want to build?
Monoliths
21 Points Health
Blog
Bug Tracker
Microservices
Online Store
Blog + Store
https://github.com/jhipster/jdl-samples
Angular, React, or Vue.js?
Comparing Angular, React, and Vue.js
Google Trends for Angular, React, and Vue.js
PWA or Mobile?
The End
Yes to PWA!
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/service-worker.js')
.then(function () {
console.log('Service Worker Registered');
});
});
}
</script>
src/main/webapp/index.html
PWA Requires HTTPS
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.requiresChannel()
.requestMatchers(r -> r.getHeader("X-Forwarded-Proto") != null)
.requiresSecure();
}
}
SecurityConfiguration.java
https://developer.okta.com/blog/2018/07/30/10-ways-to-secure-spring-boot
Want Ionic? Use Ionic4J!
Want React Native? Use Ignite JHipster!
Let's Get Started!
start.jhipster.tech
High Code Quality and Performance by Default
https://github.com/mraible/healthy-hipster
Where to deploy to?
Kubernetes
Created by Google in 2014
Based on learnings from Google's internal orchestration tool
Manages deployment of containers across a cluster of machines
Currently managed by Cloud Native Foundation
Single deployment target, multiple cloud/on-prem environments
Kubernetes
You've chosen the path to become a
YAML developer...
Everything will be YAML from here on!
Don't fear. JHipster will generate all the
YAMLs for you!
With Istio or Without?
• Kubernetes manages deployment of applications
• Istio manages the services to service communication
• Retries
• Traces
• Monitoring
• L7 Routing
• L7 Load Balancing (internal and external)
• mTLS
• Out of the box Observability with Jaeger, Kiali, Prometheus, Grafana
Kubernetes to the Cloud!
Run Kubernetes sub-generator
Deploy to GKE on GCP
Have a look 👀 at K9s
Who let the pods out?!?
https://github.com/derailed/k9s
Additional Configuration for OAuth 2.0
JHipster uses Keycloak by default
Configuration is not auto-generated for Kubernetes
Remember to configure Issuer, Client ID, and Client Secret
Load Balancer, NodePort, or Ingress...
JHipster Gateway has 2 functionalities
• The frontend code
• Routing ("/service/blog/api" → Blog Service)
• Has Retries
• But 1 extra hop
Kubernetes has built-in URL mapping via Ingress
• No retries
The End
You survived today's encounter with YAML, and
the paradox of choice.
Take the JHipster adventure, and good luck!
Congratulations!
Coming Soon: JHipster 7! 🚀
https://github.com/jhipster/generator-jhipster/issues/10958
Questions?
49
Keep in Touch!
@mraible / matt.raible@okta.com
@saturnism / rayt@google.com
Presentation
speakerdeck.com/mraible
Code
github.com/mraible

Choose Your Own Adventure with JHipster & Kubernetes - Denver JUG 2020

  • 1.
    Ray Tsang andMatt Raible Choose Your Own Adventure with JHipster & K8s @saturnism | @mraible
  • 2.
    Are you aJava developer?
  • 3.
    Are you aWeb developer?
  • 4.
    Do you likeweb frameworks?
  • 5.
    Hello, JHipster! https://jhipster.tech Application Generator DevelopmentPlatform Popular Open Source Project Monoliths, Microservices, and Gateways
  • 6.
    Who is RayTsang? Developer Advocate at Google Cloud Kubernetes Enthusiast JHipster Committer Backpacker, snowboarder, photographer @saturnism on Twitter
  • 7.
    Who is MattRaible? Developer Advocate at Okta Web Framework Enthusiast JHipster Committer Skier, rafter, classic VW fan @mraible on Twitter
  • 8.
    JHipster Gives YouLots of Options Spring Boot Spring Security SQL or NoSQL Maven or Gradle Bootstrap Angular, React, or Vue End-to-End Tests Performance Tests 26,000+ options https://arxiv.org/abs/1710.07980
  • 9.
    Choose Your OwnAdventure
  • 10.
  • 11.
    Google Trends forSpring Boot
  • 12.
    The Rest ofthe Java Pack
  • 13.
  • 14.
  • 15.
    Monolith vs. MicroserviceArchitecture Monolith Microservices Pro Single app to manage Single CI/CD pipeline Low latency between calls Low coupling Faster build / deploy cycle per service Easier to scale out individual services Con Slow build / deploy cycle High coupling Harder to scale out Multiple apps to manage Multiple CI/CD pipeline Multiple EVERYTHING! High latency and issues between calls Proper service boundary
  • 16.
  • 17.
    Microservices So you likethe difficult stuff?
  • 18.
    Unpopular Opinion "Monoliths arethe future because the problem people are trying to solve with microservices doesn’t really line up with reality." https://changelog.com/posts/monoliths-are-the-future
  • 19.
  • 20.
    Java, Kotlin, .NET,or Node? jhipster/jhipster-kotlin jhipster/jhipster-dotnetcore jhipster/generator-jhipster-nodejs
  • 21.
  • 22.
    FYI... Micronaut &Quarkus Support is in development https://github.com/jhipster/generator-jhipster-micronaut npm install -g generator-jhipster-micronaut mhipster https://github.com/jhipster/jhipster-quarkus npm install -g generator-jhipster-quarkus jhipster -d --blueprint quarkus
  • 23.
  • 24.
    Authentication: Session, JWT,or OAuth 2.0? Because friends don't let friends write authentication!
  • 25.
  • 26.
    Spring MVC orSpring WebFlux?
  • 27.
  • 28.
    What do youwant to build? Monoliths 21 Points Health Blog Bug Tracker Microservices Online Store Blog + Store https://github.com/jhipster/jdl-samples
  • 29.
  • 30.
  • 31.
    Google Trends forAngular, React, and Vue.js
  • 32.
  • 33.
  • 34.
    Yes to PWA! <script> if('serviceWorker' in navigator) { window.addEventListener('load', function() { navigator.serviceWorker.register('/service-worker.js') .then(function () { console.log('Service Worker Registered'); }); }); } </script> src/main/webapp/index.html
  • 35.
    PWA Requires HTTPS @EnableWebSecurity publicclass SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.requiresChannel() .requestMatchers(r -> r.getHeader("X-Forwarded-Proto") != null) .requiresSecure(); } } SecurityConfiguration.java https://developer.okta.com/blog/2018/07/30/10-ways-to-secure-spring-boot
  • 36.
  • 37.
    Want React Native?Use Ignite JHipster!
  • 38.
  • 39.
    High Code Qualityand Performance by Default https://github.com/mraible/healthy-hipster
  • 40.
  • 41.
    Kubernetes Created by Googlein 2014 Based on learnings from Google's internal orchestration tool Manages deployment of containers across a cluster of machines Currently managed by Cloud Native Foundation Single deployment target, multiple cloud/on-prem environments
  • 42.
    Kubernetes You've chosen thepath to become a YAML developer... Everything will be YAML from here on! Don't fear. JHipster will generate all the YAMLs for you!
  • 43.
    With Istio orWithout? • Kubernetes manages deployment of applications • Istio manages the services to service communication • Retries • Traces • Monitoring • L7 Routing • L7 Load Balancing (internal and external) • mTLS • Out of the box Observability with Jaeger, Kiali, Prometheus, Grafana
  • 44.
    Kubernetes to theCloud! Run Kubernetes sub-generator Deploy to GKE on GCP Have a look 👀 at K9s Who let the pods out?!? https://github.com/derailed/k9s
  • 45.
    Additional Configuration forOAuth 2.0 JHipster uses Keycloak by default Configuration is not auto-generated for Kubernetes Remember to configure Issuer, Client ID, and Client Secret
  • 46.
    Load Balancer, NodePort,or Ingress... JHipster Gateway has 2 functionalities • The frontend code • Routing ("/service/blog/api" → Blog Service) • Has Retries • But 1 extra hop Kubernetes has built-in URL mapping via Ingress • No retries
  • 47.
    The End You survivedtoday's encounter with YAML, and the paradox of choice. Take the JHipster adventure, and good luck! Congratulations!
  • 48.
    Coming Soon: JHipster7! 🚀 https://github.com/jhipster/generator-jhipster/issues/10958
  • 49.
    Questions? 49 Keep in Touch! @mraible/ matt.raible@okta.com @saturnism / rayt@google.com Presentation speakerdeck.com/mraible Code github.com/mraible