heidloff.net - Building is my Passion
Post
Cancel

Deploying MicroProfile based Apps to IBM Cloud private

Eclipse MicroProfile is an open source project to optimize Enterprise Java for microservices architectures. MicroProfile based applications can be deployed to Kubernetes. This article describes how to deploy a sample application to IBM Cloud private.

IBM Cloud private is a Kubernetes based platform to run cloud-native applications on-premises. It also comes with a Docker image registry. For developers there is a community edition available to run everything in one virtual machine.

The example I’m using is a simple conference application originally provided by the MicroProfile developers and slightly changed by the IBM team to showcase IBM technologies like WebSphere Liberty which has been open sourced this week. My colleagues Animesh Singh and Ishan Gulhane have documented how to deploy this sample to Kubernetes on Bluemix public.

There are different approaches to deploy applications to IBM Cloud private. I’d like to blog later about the approach to use delivery pipelines. Below I describe how to deploy from a development machine via command line.

Most of the steps to deploy the sample to Bluemix public or IBM Cloud private are identical. So I only document the differences below.

The Microservice Builder Fabric can be installed via helm commands as documented or from the IBM Cloud private admin interface.

image

Before building the images some configuration needs to be done. The hosts file of the development machine needs to be changed to define the IP of the cluster. Additionally Docker needs to be configured to be able to access the Docker host on the virtual machine. This process is a little tricky, especially on Mac. In one terminal invoke these commands:

1
2
3
ssh cluster@192.168.178.36
cd /etc/docker/certs.d/mycluster\:8500/
cp ca.crt /tmp/

In a second terminal run these commands:

1
2
3
4
5
sudo screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
mkdir /etc/docker/certs.d/
mkdir /etc/docker/certs.d/mycluster:8500/
cd /etc/docker/certs.d/mycluster:8500/
scp cluster@192.168.178.36:/tmp/ca.crt .

After this you should be able to access the Docker registry on IBM Cloud private (user: admin, pw: admin):

1
2
3
docker login mycluster:8500
docker build -t mycluster:8500/admin/microservice-vote-cloudant sample.microservicebuilder.vote
docker push mycluster:8500/admin/microservice-vote-cloudant

There is also a script to build and push all six images. If you want to use it run “./scripts/build_and_push_docker_images.sh mycluster:8500/admin”.

After the images have been pushed you can see them also in the IBM Cloud private admin interface.

image

Before the sample can be deployed, Kubernetes needs to be configured. Open the admin interface (e.g. https://192.168.178.36:8443) and choose ‘Configure Client’. Copy and paste these commands in your terminal. For example:

1
2
3
4
5
kubectl config set-cluster mycluster --server=https://192.168.178.36:8001 --insecure-skip-tls-verify=true
kubectl config set-context mycluster-context --cluster=mycluster
kubectl config set-credentials mycluster-user --token=eyJhbG......q_ATOQe-J2A
kubectl config set-context mycluster-context --user=mycluster-user --namespace=default
kubectl config use-context mycluster-context

image

‘kubectl create -f manifests’ starts the deployment which takes a couple of minutes. After this the sample application can be accessed, e.g. via http://192.168.178.36:30056/#/speakers.

Thanks a lot, again, to Ansgar Schmidt for helping me with the setup.

Featured Blog Posts
Disclaimer
The postings on this site are my own and don’t necessarily represent IBM’s positions, strategies or opinions.
Trending Tags