DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Example Java App Running in the Cloud via Kubernetes

Example Java App Running in the Cloud via Kubernetes

A developer talks about how he used Kubernetes, Istio, and Java to get a microservices application up and running.

Niklas Heidloff user avatar by
Niklas Heidloff
CORE ·
Apr. 17, 19 · Opinion
Like (3)
Save
Tweet
Share
6.76K Views

Join the DZone community and get the full member experience.

Join For Free

over the last few weeks i've worked on a new sample application which demonstrates how to build microservices-based architectures. while there are still some minor things i'd like to add, i think the sample is pretty comprehensive now and a good option for developers, especially java ee developers, to learn microservices and cloud-native patterns.

the example is available as open source. the github repo is called cloud-native-starter .

kubernetes, istio, and java

when building cloud-native applications, developers are challenged to figure out how to address topics like traffic routing, resiliency, distributed monitoring, service discoveries, and more. fortunately most of these new challenges are handled by the orchestration platform kubernetes and the service mesh istio . this functionality works generically for microservices, regardless of the language they are implemented in and without changes to the application logic.

however, some functionality cannot be covered by orchestration platforms and service meshes. instead it must be handled in the business logic of the microservices, for example application specific failover functionality, metrics, and fine-grained authorizations.

java developers can leverage eclipse microprofile to implement this functionality. microprofile is an extension to java ee (enterprise edition) to build microservices-based architectures and it complements kubernetes and istio capabilities. in addition to the application specific logic which kubernetes and istio cannot handle, it also comes with convenience functionality that you typically need when developing microservices, for example mechanisms to invoke rest apis and functionality to implement rest apis including their documentation.

design principles

the example application follows these design principles:

  • leverage platforms as much as possible — do as little as possible in language-specific frameworks.
  • use open-source components for the core services of the application only.
  • make the first time experience as simple as possible.
  • be able to run the application in different environments.

let me explain the design principles in more detail.

leverage platforms as much as possible — do as little as possible in language-specific frameworks

the advantage of using kubernetes and istio for features like traffic management is that these features are language agnostic. cloud-native applications can be, and often are, polyglot. this allows developers to pick the best possible languages for the specific tasks.

use open-source components for the core services of the application only

in my role as a developer advocate i talk with many developers. pretty much everyone loves open source. in order to reach as many developers as possible, the sample application only uses open source projects for the core services of the application. for example, the java stack leverages openj9 , openjdk from adoptopenjdk , openliberty , and microprofile . kubernetes and istio are obviously open source projects as well. the components of the application that are not available as open source are optional and can be exchanged.

make the first time experience as simple as possible

there are many samples, snippets, articles, and tutorials available for the various cloud-native features and many of them are really good. however, i've had issues running some of these features together in one application. sometimes they used different java stacks, sometimes different versions, and sometimes the articles were outdated.

the example application shows several features working together (see below for details). there are also scripts to deploy services very easily, basically one script per service, similar to the 'cf push' experience for cloud foundry applications.

be able to run the application in different environments

fortunately this is one of the main advantages of kubernetes since you can run workloads in on-premises, hybrid, or public cloud infrastructures. the repo has instructions how to deploy the application to minikube and to the managed ibm cloud kubernetes service .

functionality of the sample application

the project demonstrates the following functionality:

  • dockerizing java microprofile services
  • traffic management
  • authentication and authorization
  • resiliency
  • rest apis implementations including documentation
  • rest api invocations
  • monitoring and metrics
  • distributed logging and monitoring

this diagram shows the services and components:

the web application invokes an api of a bff (backend for front-end) service to display articles with authors.

call to action

if you want to learn cloud-native applications, get the code of the example application and follow the instructions to set up a local minikube environment and to deploy the microservices. if you have already a kubernetes cluster, the setup should not take longer than half an hour.

you can also run this application on the ibm cloud kubernetes service , which is a managed service that comes with an istio plugin . ibm provides an ibm cloud lite account, which is free, no credit card is required and there is no time restriction. then follow these instructions to deploy the services to the ibm cloud.

i also want to thank everyone who has helped to create this application, especially harald uebele who has written a lot of the code and scripts.

Kubernetes application Java (programming language) Cloud Open source microservice Web Service IBM Cloud app dev

Published at DZone with permission of Niklas Heidloff, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • DZone's Article Submission Guidelines
  • The Quest for REST
  • A Brief Overview of the Spring Cloud Framework
  • How To Create and Edit Excel XLSX Documents in Java

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: