Orchestrating Docker Containers with Kubernetes

Niklas Heidloff
Jul 27, 2017 · 2 min read

Last month, IBM announced it would offer Kubernetes support in the IBM Bluemix Container Service as a beta release. Below is a short introduction to Kubernetes and a short description how to get started using Kubernetes on IBM Bluemix.

Kubernetes allows users to run and manage cloud-native apps that consist of multiple containers. To get started, you need to know some terminology. For example, a “deployment” contains “pods” that can contain multiple Docker containers (but typically contain one container). Deployments run in “worker nodes” that are part of a “cluster.” “Services’ define how deployments can be accessed. I like this video, which explains this terminology well.

To start using Kubernetes on Bluemix, you should follow this three-part tutorial.

Part 2 shows how to run multiple replicas of pods and how to scale them up and down. The screenshot shows the Kubernetes web interface that displays the status of the three replicas/pods. The sample also explains how Kubernetes can do health checks. If Kubernetes detects an issue with a pod, it stops it and and creates a new one automatically.

Part 3 of the tutorial shows how to use a Bluemix service from a container running in Kubernetes. After you’ve created an instance of a Bluemix service, you can bind it to the Kubernetes cluster. In the configuration yml file, the service credentials are mounted to a volume. Containers can read these from there at runtime.

Containers can access other containers simply via the container’s (service’s) DNS name.

app.get('/analyze/:string', function(req, res) {   request.get({ url: "http://watson-service:8081/analyze?text=" + req.params.string },      function(error, response, body) {         ...});

This is how to define a service, in this case the ‘watson-service’.

apiVersion: v1kind: Servicemetadata:   name: watson-service   labels:      run: watson-demospec:   type: NodePort   selector:      run: watson-demo   ports:      - protocol: TCP        port: 8081        nodePort: 30081

Originally published at heidloff.net on April 7, 2017.

Niklas Heidloff

Written by

Developer Advocate. I like learning, conversational UX, serverless and BBQ. Father of five. Working for IBM. Opinions are my own.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade