{{announcement.body}}
{{announcement.title}}

Automated Deployment of a Microservice to Kubernetes on IBM Cloud

DZone 's Guide to

Automated Deployment of a Microservice to Kubernetes on IBM Cloud

This tutorial demonstrates how to automate the deployment of a microservice using a delivery pipeline on IBM Cloud.

· Cloud Zone ·
Free Resource

In this blog post, I want to explain 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 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, therefore, 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 contain a job called Fetch code and the  DELOY_SERVICES has two jobs one for build and one for deployment.

Fetch and Deploy_Services

Fetch and Deploy_Services


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.

Toolchain setup and execution

Toolchain setup and execution


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.

Basic Understanding of What a Toolchain on IBM Cloud Does

The toolchain is related to the topic of 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.
Areas of an IBM toolchain

Areas of an IBM toolchain


  • 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 continuous delivery of the Microservice with the Continuous Delivery service on IBM Cloud. 

How to Set up A Custom Toolchain

Custom toolchain

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.

  • 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

Topics:
automated deployment ,automation ,cloud ,deployment ,ibm cloud ,kubernetes ,microservice ,toolchain ,tutorial

Published at DZone with permission of Thomas Suedbroecker . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}