In this hands-on lab, you will follow a set of exercises to deploy Java microservices based on MicroProfile to a Kubernetes cluster.
Sign up for a new account on the Bluemix Dashboard.
Access the Bluemix Containers dashboard at https://console.bluemix.net/containers-kubernetes/home/clusters
Click the Create Cluster button, choose the "Lite" cluster option and give it a name like "MicroprofileHOL". It should take 10-20 minutes for a new Kubernetes cluster to get spun-up. You can continue for now - we'll verify that the cluster is running in Exercise 3.
Install by Bluemix CLI - Find the appropriate installer and follow the instructions here.
Login to the CLI with bx login
. When prompted, use API endpoint api.ng.bluemix.net
You'll need to install a couple of plugins for the Bluemix CLI as well:
bx plugin install dev -r Bluemix
bx plugin install container-service -r Bluemix
# Initialize and verify plugin install
bx cs init
Install the following tools:
Verify you have the proper versions (newer should be fine):
$ docker -v
Docker version 17.09.0-ce, build afdb6d4
# Note this command will fail when checking the server version - it's expected as your CLI is not configured to connect to a server yet.
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.6", GitCommit:"114f8911f9597be669a747ab72787e0bd74c9359", GitTreeState:"clean", BuildDate:"2017-03-28T13:54:20Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
# Note this command will fail when trying to connect to Tiller, we'll configure this later
$ helm version
Client: &version.Version{SemVer:"v2.6.1", GitCommit:"bbc1f71dc03afc5f00c6ac84b9308f8ecb4f39ac", GitTreeState:"clean"}
Error: cannot connect to Tiller
$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
$ mvn --version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T14:39:06-05:00)
Maven home: /Users/svennam/Downloads/apache-maven-3.5.0
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.1", arch: "x86_64", family: "mac"
You should run through the set of exercises sequentially. Each should take around 5-10 minutes to complete.
- Exercise 1: View, edit and build your Microprofile Java repositories
- Exercise 2: Build and push each of your microservices to DockerHub
- Exercise 3: Use Helm to deploy fabric prerequisites
- Exercise 4: Deploy your microservices to your Kubernetes cluster
- Exercise 5: Managing your Kubernetes Cluster
- Bonus Exercise: Develop Java Microservices using Microservice Builder
To learn more about the microservices that we deployed and how they utilize the Java Microprofile technology, see the GitHub project. There are extensive instructions on how to actually develop these microservices.
On the IBM Developer Works website, see the full journey that explains the steps we followed, architecture diagrams, blogs, utilized technologies and more.
Get started with running a Kubernetes cluster on your local machine for development. Minikube.
Manage your Kubernetes cluster on IBM Cloud.
You can contact me directly on Twitter at @sai_vennam.