Setting up a cloud-native Sample App on Minishift in an Hour

My colleague Harald Uebele and I have developed an end-to-end sample application to help developers to get started with developing microservices and deploying them to Kubernetes. We have documented how to run this application on Minikube and the IBM Cloud Kubernetes service. This week we added documentation and scripts how to deploy the same application to Minishift in less than an hour.

The application is available as open source. My previous article Example Java App running in the Cloud via Kubernetes explains this project and the design principles.

The sample showcases various cloud-native functionality: REST APIs, traffic management, resiliency, distributed logging and more. There is also documentation how to do authentication, authorization, persistence and other observability functionality. The application comes with a simple web frontend which displays links to articles.

The Vue.js web application accesses a Web-API service which invokes an Articles service and an Authors service. To demonstrate traffic management, there are two versions of the Web-API service.

Setup of Minishift and the Sample Application

OKD is the open source upstream Kubernetes distribution embedded in OpenShift. Minishift is a tool that allows you to run OKD 3.x locally by running a single-node cluster inside a VM. We have used Minishift v1.34.0 and OKD v3.10.0.

We have documented in the repo the steps to install Minishift, Istio and the sample application. The main steps are:

  1. Get Minishift
  2. Create a cluster
  3. Try the oc CLI
  4. Install Istio
  5. Install the sample’s prerequisites and the sample application

We have automated this setup as much as possible by providing several scripts. On my 5 years old MacBook Pro with 16 GB RAM it took me less than an hour. To find out what exactly the scripts do, check out the code and read two articles from Harald Deploying the Cloud Native Starter microservices on Minishift and Cloud Native Starter and OpenShift, OKD, Minishift.

Motivation

There are several reasons why we’ve worked on this.

1. Learn OKD

One was simply to learn more about OKD, Minishift and OpenShift since IBM offers a new managed Red Hat OpenShift service on the IBM Cloud (beta).

2. Run existing Kubernetes applications on OKD

Another reason was to proof that you can deploy applications that have been developed for pure Kubernetes environments to the Kubernetes distribution OKD (‘Run anywhere’). OKD offers several ways to deploy applications, some of them make it really easy for developers so that you don’t have to understand in depth Kubernetes, Dockerfiles and yaml files. To achieve maximal flexibility and to deploy existing applications to OKD, you can also use standard Kubernetes deployment techniques like ‘kubeclt apply -f config.yaml’ which is what we’ve done.

3. Leverage the OKD image registry

Kubernetes does not come with an image registry. Since you need a registry to run cloud-native enterprise applications, vendors like IBM offer managed private registries. OKD comes already with a registry out-of-the-box. This screenshot shows the image of the Authors service in the web console.

4. Leverage the server-side builds

One way to deploy applications is to host the code in a Git repository. When new code is pushed, builds can automatically be triggered which run server-side on OKD. The screenshot shows the build history of the Authors service including the logs.

There are several resources to find out more about this sample application: