Automated deployment of a microservice to Kubernetes on IBM Cloud

In that blog post I want to point out the awesome topic, how to automate the deployment of a Microservice using a delivery pipeline on IBM Cloud.

Maybe you already know Niklas, Harald and I made the great project called Cloud Native Starter. That project includes a Hands-on workshop that is called “Build a Java Microservice and deploy the Microservice to Kubernetes on IBM Cloud”.  In Lab 4 you have to deploy the Authors Microservice to Kubernetes on IBM Cloud. Sometimes we have limited time in workshops. The limited time is the reason why we want to reduce the manual effort for students in a workshop to a minimum, therefor we took the IBM® Cloud Continuous Delivery and I created a repeatable way with minimal human interaction. The delivery pipeline contains sequences of stages which retrieve inputs and run jobs, such as builds, and deployments.

That image shows two stages, one stage is called FETCH and the other DEPLOY_SERVICES. The FETCH stages contains a job called Fetch code and the DELOY_SERVICES has two jobs one for build and one for deployment.

Toolchain-04

With the realization of the automated setup for the creation of the toolchain, you can just press the button Create toolchain in the GitHub project and follow a guided wizard to deploy the Authors Microservice. (Visit the GitHub project Use a IBM Cloud toolchain to deploy a Java Microservices to Kubernetes on IBM Cloud to press the button ;-))

Toolchain-01jpg

That toolchain automates following major manual deployment steps in the workshop for the Authors Microservice.

  • Build the container for the Authors Microservice
  • Save the container in the IBM Cloud Registry
  • Deploy the Authors Microservice to the free Kubernetes cluster on IBM Cloud

If you want to check it out, just visit the GitHub project and press Create toolchain and follow the instructions. A wizard creates the toolchain for you, clones the Cloud Native Starter Project to a source code repository and does execute a deployment pipeline. The deployment pipeline does the deployment of the Authors Microservice to Kubernetes on IBM Cloud.

Here you see how to access the deployed Authors service running on the free Kubernetes Cluster on IBM Cloud.

toolchain-02

Let’s get a basic understanding what a toolchain on IBM Cloud does

The toolchain is related to the topic continues-delivery, if you want to learn more, just visit learn continuous-delivery.

The text with the links below is a great starting point to understand the toolchain.

“A toolchain is a set of tool integrations that support development, deployment, and operations tasks. The collective power of a toolchain is greater than the sum of its individual tool integrations.
You can create an open toolchain on IBM Cloud in two ways: by using a template or from an app. See the toolchains and tool integrations that are available in your region and IBM Cloud environment.” (source at IBM)

Here are the three major areas of a IBM Cloud toolchain, with a simplified short description of the tools I configured in the toolchain.

Toolchain-02

  • THINK – Doing basic lean requirements and issue management with GitLab on IBM Cloud.
  • CODE –  Handling source-control with a proven source code repository GitLab and an open source Integrated Development Environment (IDE) Eclipse Orion Web for online editing of the source code on IBM Cloud
  • DELIVERY –  Managing  the continues delivery of the Microservice with the Continuous Delivery service on IBM Cloud. 

How to setup a custom toolchain

To ensure there will be no additional task for a student in a workshop during the creation of an own toolchain, I had to implement a custom toolchain template. In that link you find a great starting point to learn, how to create custom toolchain templates.  You can also visit my .bluemix  folder in the GitHub project. That folder contains the configuration I applied.  The following image and table contains a short description of the  .bluemix folder.

Toolchain-03

  • The nls folder contains the translated files
  • The locales.yml file includes the referenced files containing the mapping between locales and translated files, that are stored in the nls folder.
  • The pipeline.yml file contains details for the pipeline. That means definitions of stages, jobs, variables, bash commands and so on.
  • The deploy.json file defines form inputs for the user interaction.
  • The toolchain.yml file specifies the toolchain, including source code repositories to pull in, services to include, and build details.

I hope this was useful for you and let’s see what’s next?

Greetings,

Thomas

PS:  You can try out Cloud Foundry Apps or Kubernetes on IBM Cloud. By the way, you can use the IBM Cloud for free, if you simply create an IBM Lite account. Here you only need an e-mail address.

#IBMDeveloper, #IBMCloud, #Kubernetes, #DeliverPipeline, #Toolchain, #Continues Delivery

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.