cloud-native-starter-one-service-workshop-toolchain

This project does automate the deployment in Lab 4 of the authors microservice of the Cloud Native Starter workshop Build a Java Microservice and deploy the Microservice to Kubernetes on IBM Cloud to a free Kubernetes cluster on IBM Cloud.

View on GitHub

Use a IBM Cloud toolchain to deploy a Java Microservices to Kubernetes on IBM Cloud

Toolchain for the - ‘Build a Java Microservice and deploy the Microservice to Kubernetes on IBM Cloud’ - workshop

This project does automate the deployment in Lab 4 of the authors microservice of the Cloud Native Starter workshop Build a Java Microservice and deploy the Microservice to Kubernetes on IBM Cloud to a free Kubernetes cluster on IBM Cloud.

That are the steps the toolchain automates:

In the following image you get an overview of the authors microservice deployment to the free IBM Cloud Kubernetes Cluster.

verview of the authors microservice deployment

Table of Content

IBM Cloud Setup

  1. Register for IBM Cloud
  2. Insert feature code
  3. Create a free Kubernetes cluster
  4. Configure the IBM Cloud Container Registry

Toolchain setup and execution

  1. Build a IBM Cloud toolchain
  2. Work with the created toolchain

Verify the deployed authors microservice

Additional information

IBM Cloud Setup

1. Register for IBM Cloud

Step 1: Open a browser window and navigate to the IBM Cloud Registration page.

Registration

Email Validation

Step 3: Login into IBM Cloud using your account credentials.

Note: By default, all new IBM Cloud accounts are set to a lite account.

The lite account provides free access to a subset of IBM Cloud resources. Lite accounts don’t need a credit-card to sign up and they don’t expire after a certain period of time. In order to create a free Kubernetes cluster, you need a feature code.

2 Insert feature code

In order to execute the workshop easily, we provide feature codes to create free Kubernetes clusters, so no credit card details are required. To apply the feature code to your Cloud Account, navigate to your “Account settings” and then to (“Manage” -> “Account”). Enter your unique Feature (Promo) Code to upgrade your lite account.

Note: Free clusters expire after one month.

3 Create a free Kubernetes Cluster

Step 1: Logon to IBM Cloud

Step 2: Select in the menu “Catalog” and search for “Kubernetes Cluster”

Kubernetes service

Step 3: Click on “Kubernetes Cluster”

Step 4: Press “Create”

create Kubernetes service

Step 5: Click on the Kubernetes Services and select “Free”

Ensure you set following values in the creation dialog and don’t change the remaining values:

Note: In the new IBM Cloud UI it seems the enties for Geography and Metro are no longer available.

create Kubernetes service

Step 6: Press “Create custer”

Step 7: Now you will be forwarded to your cluster on IBM Cloud and you can verify the status of the creation of your cluster

The creation of the custer takes up to 20 min.

Note: If you in a hands-on session please inform your instructor that you have finished step 7.

create Kubernetes service

4 Configure the IBM Cloud Container Registry

Step 1: Select in Kubernetes the entry Registry and ensure your are in the Dallas location.

Select in Kubernetes the entry Registry

Step 2: The create a namespace with a unique name cloud-native-[YOURNAME]

The create a namespace with a unique name cloud-native

Note: Namespaces are required to be unique across the entire region that the specific registry is located in, not just unique to your account. This is mentioned in the following public documentation.

Step 3: Verify the namespace was created

Verify the namespace was created

Toolchain setup and execution

1 Build a IBM Cloud toolchain

Step 1: Press “Create toolchain”

Create toolchain

Step 2: Select the Dalles as region

Select the Dalles region

Step 3: Configure the location for the cloned GitHub project

I our situation we use git repos and issue tracking hosted by IBM and built on GitLab Community Edition.

We will clone the Cloud Native Starter project to a repository called cloud-native-starter-one-service-workshop-TIMESTAMP.

Configure the location for the cloned GitHub project

Note: Depending on your region selection you maybe have to authorize the GitLab hosted in that IBM region.

Authorize the GitLab hosted in that IBM region

Step 4: Create a IBM Cloud API key by pressing “new” and “ok”

Enable the toolchain to create services or set configurations in your IBM Cloud Account, for that it needs an “IBM Cloud API key” depending the region you are working in.

Note: You will be informed which name is already in use.

Create a IBM Cloud API key

Notification dialog

Step 5: Verify the configuration

You see your the relevant information of your created IBM Cloud Container Registry and the IBM Cloud Cluster. Do not change the defaults!

IBM Cloud Container Registry and the IBM Cloud Cluster information

Note: If you change the Kubernetes namespace name, you need to be aware of the image pull secret credentials to access a container registry. For more details please visit the following pages.

Step 6: Press “Create”

Press Create

2 Work with the created toolchain

In the toolchain you see:

Step 1: Visit the create GitLab project inside IBM Cloud

Open the GitLab repository in a new browser tab.

Open the GitLab repository in a new browser tab

Step 2: Take a look in the cloned Cloud Native Starter project

Take a look in the cloned Cloud Native Starter project

Step 3: Go back to the toolchain and visit the delivey pipeline

Open the delivery pipeline

Step 4: In the delivery pipeline you see two stages

Wait until the stages and their jobs are executed.

Open the delivery pipeline

Verify the deployed authors microservice </a>

Step 1: Open the deployment job in a new browser tab

Open the deploy java authors microservice to the Kubernetes cluster job, in the DEPLOY SERVICES stage of the pipeline.

Open the deploy job in a new browser tab

Step 2: Verify the deployment job logs and open the OpenAPI explorer of the authors microservice to test the microservice

You see following steps in the following gif.

  1. Find the URL of the authors OpenAPI explorer in the logs
  2. Copy the OpenAPI explorer URL in to a browser or just open the URL in a new tab of the current browser

    OpenAPI explorer URL

  3. Press “Try it out”
  4. Press “Execute”
  5. Verify the “Reponse body”

    {
     "name": "Niklas Heidloff",
     "twitter": "https://twitter.com/nheidloff",
     "blog": "http://heidloff.net"
     }
    

Verify the deployment result and open the OpenAPI explorer of the authors microservice and test the microservice

:star: Congratulations :thumbsup: you have finished the workshop.

Additional information

Information resources about developing a open toolchain