The goal of this post is guide you through the steps of deploying Interlok containers in Kubernetes. Minikube is used, Minikube is a tool that makes it easy to run Kubernetes locally. As we all know; Kubernetes is an open-source platform for automating deployment, scaling, and operations of application containers across clusters of hosts, providing container-centric infrastructure.
Setting up your Minikube environment
You’ll already have docker installed so you can just follow the detailed instructions available to install from Minikube & kubectl. Once everything is installed you need to create a Minikube VM:
The above command assumes the following:
You are using Hyper-V as your hypervisor (Windows 10 FTW)
Now we need to set the kubectl context to use Minikube and then verify everything is in working order.
Creating your Interlok Config
For testing purposes we will create an Interlok instance using a jetty-message-consumer that returns the text “Hello World”. First create a project directory called interlok-kubernetes within that create another directory config and create an adapter config file with the following contents:
It’s recommended to test the config is working as expected by starting your local Interlok instance and loading it.
Creating your Docker Container image
In the created directory (interlok-kubernetes) create a new Dockerfile:
An image needs to created inside the minikube environment so let’s point docker at minikube and build the image.
Of course you can customise how you build your docker image; since our hello-world application is very simple, we don’t need any other additional libraries; for different ways to customise your docker container image check out the git project docker-interlok-template.
Create a Deployment
Next we create a Kubernetes Pod. A Pod is group of one of more containers. We use the kubectl run commands
Once it’s started, then we can view deployments using kubectl get deployments which gives you a list of all the deployments; view the pods using kubectl get pods. The output of both should reference hello-interlok in one way or another. The important one here is the pod name; you’ll be needing that later.