One of the advantages of microservices architecture is that it gives you the choice to select a platform which is best suited for a specific service. For example some services could be running on Intel platforms, whereas few other services can run on Power platforms. This article describes how you can deploy such a microservices application on a Kubernetes cluster having Intel and PowerPC LE (ppc64le) nodes.
This sample microservices application simulates a fictional airline company called – Acme Air and consists of the following services:
acmeair-mainapp: The Front End and the main service
acmeair-as: The Authentication service
acmeair-cs: The Customer service
acmeair-fs: The Flight service
acmeair-bs: The Booking service
acmeair-ss: The Support service
Each of the services also depends on a database. Mongodb is used as the database.
In the setup described here, all the services run on Power nodes, whereas some of the Mongodb instances runs on Intel nodes.
The code used in this article is available here – https://github.com/bpradipt/acmeair
Building the packages
The instructions described in the following sections are performed on an Ubuntu 16.04 LE (ppc64le) system
Install pre-req packages
$ sudo apt-get install git gradle openjdk-8-jdk
Set JAVA_HOME
$ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-ppc64el $ export PATH=$JAVA_HOME/bin:$PATH
Build the packages
$ git clone https://github.com/bpradipt/acmeair.git $ cd acmeair $ gradle build
Build docker images
$ for i in acmeair-fs acmeair-as acmeair-cs acmeair-bs acmeair-ss acmeair-mainapp; do cd $i && sudo docker build -t $i -f Dockerfile.ppc64le . && cd .. ; done
Push the images to a registry
In this example I’m using the local registry which is available at master.cfc:8500. I have a ‘test’ namespace created for the user ‘test’ in the registry. If you are using Dockerhub or any other registry, please change the parameters accordingly.
$ sudo docker login master.cfc:8500 Username: test Password: Login Succeeded $ for i in $(sudo docker images | grep acmeair | awk '{print $1}'); do sudo docker tag $i master.cfc:8500/test/$i; sudo docker push master.cfc:8500/test/$i; done
Deploy the app
Create a Kubernetes secret ‘regsecret’ for the registry credentials that can be used by the nodes to pull the images from the registry. You won’t need this if you are using a registry configured to allow unauthenticated ‘pulls’.
$ kubectl create secret docker-registry regsecret --docker-server=master.cfc:8500 --docker-username=test --docker-password=test --docker-email=test@example.com
Download the sample YAML file for the app
$ wget https://raw.githubusercontent.com/bpradipt/acmeair/master/k8s-acmeair-multiarch.yaml
Ensure you replace the variable DNS_HOST_NAME_OF_PROXY_NODE with the DNS name of the ingress/proxy node. For example if vm1 is the DNS name of the proxy node in your setup then all occurrences of the following string host: <DNS_HOST_NAME_OF_PROXY_NODE> should be changed to host: vm1
You’ll also need to modify the image location as per your environment.
Two mongodb PODs are deployed on Intel nodes using the following construct nodeSelector: beta.kubernetes.io/arch: amd64 . Rest of the PODs are deployed on PowerPC LE (ppc64le) nodes using the following construct nodeSelector: beta.kubernetes.io/arch: ppc64le
$ kubectl create -f k8s-acmeair-multiarch.yaml
In case you are not using a mixed cluster, you can use the k8s-acmeair.yaml file from the same repo for deployment.
Hope this helps.