Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Orchestrating Docker Containers with Kubernetes

DZone's Guide to

Orchestrating Docker Containers with Kubernetes

In this post, we take a look at how you can get ahead of the curve by using IBM Bluemix's beta support of Kubernetes.

· Cloud Zone
Free Resource

MongoDB Atlas is a database as a service that makes it easy to deploy, manage, and scale MongoDB. So you can focus on innovation, not operations. Brought to you in partnership with MongoDB.

Last month IBM announced the beta of Kubernetes support in the IBM Bluemix Container Service. Below is a short introduction to Kubernetes and a short description how to get started using Kubernetes on IBM Bluemix.

In a nutshell, Kubernetes allows running and managing 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’ are run in ‘Worker nodes’ that are part of a ‘Cluster’. ‘Services’ define how deployments can be accessed. I like the following 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 creates a new one automatically.

Image title

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: v1
kind: Service
metadata:
  name: watson-service
  labels:
    run: watson-demo
spec:
  type: NodePort
  selector:
    run: watson-demo
  ports:
   - protocol: TCP
     port: 8081
     nodePort: 30081


MongoDB Atlas is the best way to run MongoDB on AWS — highly secure by default, highly available, and fully elastic. Get started free. Brought to you in partnership with MongoDB.

Topics:
cloud ,kubernetes ,ibm bluemix ,container orchestration

Published at DZone with permission of Niklas Heidloff, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}