Coding Java in a Kubernetes World

In this workshop, we will dive into MicroProfile and Jakarta EE APIs for developers to build robust, portable and scalable Java microservices and cloud-native applications in a practical and hands-on manner. Particular attention will be given to application aspects intersecting with Kubernetes that developers should keep in mind when following the 15-factor application model.

 

What is Java?

Java is a popular programming language especially for enterprises.  With open cloud-native API like MicroProfile and Jakarta EE, Java continues to lead in enabling developers to build cloud-native applications and particularly for Kubernetes-based deployments.

What is Kubernetes?

Kubernetes is an open source container orchestrator that automates many tasks involved in deploying, managing, and scaling containerized applications. Over the years, Kubernetes has become a major tool in containerized environments as containers are being further leveraged for all steps of a continuous delivery pipeline.

Why use Kubernetes?

Managing individual containers can be challenging. A small team can easily manage a few containers for development but managing hundreds of containers can be a headache, even for a large team of experienced developers. Kubernetes is a tool for deployment in containerized environments. It handles scheduling, deployment, as well as mass deletion and creation of containers. It provides update rollout abilities on a large scale that would otherwise prove extremely tedious to do. Imagine that you updated a container image, which now needs to propagate to a dozen containers. While you could destroy and then re-create these containers, you can also run a short one-line command to have Kubernetes make all those updates for you. Of course, this is just a simple example. Kubernetes has a lot more to offer.

Why use open cloud-native Java for Kubernetes?

Modern cloud-native Java APIs like MicroProfile and Jakarta EE are openly and collaboratively defined and supported by many runtimes, such as Open Liberty. Jakarta EE and MicroProfile make it easy for developers to write applications that follow best practices, like the 15-factor application methodology, for deployments in containers onto a Kubernetes platform in public, private or hybrid cloud. For example, MicroProfile Health Check API allows developers to easily report on the statuses of their services that Kubernetes can probe periodically to make decisions on scaling for high availability. This maps to the Disposability and Telemetry factors of the 15-factor considerations. Another example is the MicroProfile Config API that enables configuration information to be easily externalized and injected into an application as configuration sources giving us clean code without hardcoding and hence, achieving the Configuration factor of the 15 factors.

 

Workshop Instructions

Go over the following lab modules one by one to learn first hand how you can easily add health reports and externalize configuration using MicroProfile Health Check and Configuration APIs for your cloud-native Java applications. Then, see how your services can be deployed onto Kubernetes and further explore how the health reports and externalized configuration are used in a Kubernetes environment.

When you access the lab modules for the first time, you will be asked to login once either using one of the supported Single Signon Providers or by creating a new account with IBM Developer Skills Network. Subsequently, you will be provided with a cloud-hosted environment with a cloud-based IDE and terminal that you can use to complete each lab module (in turn) following the provided instructions (in about 20 minutes each). After you complete a lab module, you can return to this page to access the next module on the list.

 

MicroProfile Lab Modules:

Adding health reports to microservices

Configuring microservices

Kubernetes Lab Modules:

Deploying microservices to Kubernetes

Checking the health of microservices on Kubernetes

Configuring microservices running in Kubernetes

 


Alternative

Run the lab modules locally