Tag Archive for: Docker

MNLAB Meetup – Kubernetes

What did we talk about?

This week, the subject of our MNLAB meetup was Kubernetes! Well…, not only Kubernetes but also a few other topics which are included in the following presentation title. We started with a short history of how things evolved from the bare-metal age, to what we call today serverless. Then we continued with containers, container runtimes, container orchestration and Kubernetes. Finally, we closed the meetup with some humorous quotes and pics regarding computer science and “abstractions”.

 

Download

  • the presentation .pptx file from here (~23MB)
  • or the .pdf version from here (~4MB but with no embedded video)

 

*aaS – what should I remember?

That during the evolution of all these years we’ve been searching for the right abstraction for developers to write apps and this seems to be PaaS…

and as Sam Newman says in the following video: “it’s all about abstractions”.

 

 

Containers – what should I remember?

  • They are NOT virtual machines
  • They are processes born from tarballs, anchored to namespaces and controlled by cgroups.
  • Linux containers (LXC, LXD) existed before Docker
  • There have been some container-runtime wars and this has had an effect to the history of Kubernetes

 

Kubernetes – what should I remember?

  • it is a platform where you can run container workloads
  • it’s easier for everyone to understand abstractions he/she builds or grow organically within an organization
  • the key is to understand that Kubernetes brings a lot of abstractions to solve a lot of common problems
  • it’s not the perfect tool for every job. Your case might need something simpler. Kubernetes is a good solution in case your apps face traffic spikes and you need scaling solutions.
  • Kubernetes also offers solutions to deployments problems (green-blue, canary, rolling updates, rolling-back)
  • designing / writing / testing / maintaining / running software (for highly available apps) involves collaboration between different groups of people and sometimes there are repetitive tasks and procedures that may take a lot of time or might have conflicts…

…Kubernetes is here to help us solve problems faced by System ops, DevOps teams, Developers, QA engineers, Site Reliability engineers… (read more at the k8s comic).

Abstractions – what should I remember?

Abstractions have helped computer science evolve. But there has always been the question: “how much abstraction is too much abstraction?”. The humorous Fundamental Theorem of Software Engineering states that:

“We can solve any problem by introducing an extra level of indirection”

and is often expanded by the clause:

“…except for the problem of too many levels of indirection”

implying that too many abstractions may create intrinsic complexity issues of their own.

 

 

 

 

Read more…

Launching Docker containers in OpenStack

In this post we will show how to configure a compute node in OpenStack to launch Docker containers. We assume that you already have a working OpenStack installation. The configuration we describe below worked for OpenStack Juno, while the controller and compute nodes were running Ubuntu 14.04 LTS.

Install Docker and Docker driver for OpenStack on the compute node

Installing Docker in Ubuntu (Docker only works for 64 bit Ubuntu OS):

 sudo sh -c "curl https://get.docker.io/gpg | apt-key add -"
 sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
 sudo apt-get update
 sudo apt-get install lxc-docker

Add nova to the docker group and restart the compute service to pick up the change:

sudo usermod -G docker nova
sudo service nova-compute restart

Install the nova-docker driver:

sudo apt-get install python-pip
sudo apt-get install python-dev
git clone https://github.com/stackforge/nova-docker
cd nova-docker
git checkout stable/juno
sudo python setup.py install

 

Configuring the compute and the controller nodes for Docker

Nova configuration in the compute node

With admin privileges edit the configuration file /etc/nova/nova.conf according to the following options:

[DEFAULT]
compute_driver = novadocker.virt.docker.DockerDriver
vif_plugging_is_fatal=False 
vif_pligging_timeout=0

Create the directory /etc/nova/rootwrap.d, if it does not already exist, and inside that directory create a file “docker.filters” with the following content:

# nova-rootwrap command filters for setting up network in the docker driver
# This file should be owned by (and only-writeable by) the root 
[Filters]
# nova/virt/docker/driver.py: 'ln', '-sf', '/var/run/netns/.*'
ln: CommandFilter, /bin/ln, root

Glance configuration in the controller node

Glance also needs to be configured to support the Docker container format, in /etc/glance/glance-api.conf (found in controller):

[DEFAULT]
container_formats = ami,ari,aki,bare,ovf,docker

And then restart the Glance service:

service glance-api restart
service glance-registry restart

Now, back to the compute node

Do the following:

sudo chmod 666/var/run/docker.sock
sudo chmod 777/var/run/libvirt/libvirt-sock
service nova-compute restart
sudo service docker restart

And edit the /etc/nova/nova-compute.conf:

[DEFAULT]
compute_driver=novadocker.virt.docker.DockerDriver
#[libvirt]
#virt_type=kvm

 

Launching Docker containers

Example: A minimal container that runs an http server (thttpd) on port 80

In the compute node:

docker pull larsks/thttpd
docker save larsks/thttpd | glance image-create --is-public True --container-format docker --disk-format raw --name larsks/thttpd

In the controller node, first source your OpenStack RC file and then boot your docker instance:

source demo-openrc.sh
nova boot --image "larsks/thttpd" --flavor m1.small --nic net-id=fa234617-3ec6-481c-a17e-89bd54fce60b --availability_zone=nova:node3 docker-test-vm

Now, check instances in Openstack Horizon to see our newly created instance is running. Then, assign a floating IP address through Openstack horizon and try http://<assigned_ip>/ to see if it is working.

That’s all!