Getting Started with Kubernetes / Docker on Fedora

These are my notes on how to get started evaluating a Fedora / Docker / kubernetes environment. I'm going to start with two hosts. Both will run Fedora rawhide. The goal is to stand up both hosts with kubernetes / Docker and use kubernetes to orchestrate the deployment of a couple of simple applications. Derek Carr has already put together a great tutorial on getting a kubernetes environment up using vagrant. However, that process is quite automated and I need to set it all up from scratch.

Install Fedora rawhide using the instructions from here. I just downloaded the boot.iso file and used KVM to deploy the Fedora rawhide hosts. My hosts names are: fed{1,2}.

The kubernetes package provides four services: apiserver, controller, kubelet, proxy. These services are managed by systemd unit files. We will break the services up between the hosts. The first host, fed1, will be the kubernetes master. This host will run the apiserver and controller. The remaining host, fed2 will be minions and run kubelet, proxy and docker.

This is all changing rapidly, so if you walk through this and see any errors or something that needs to be updated, please let me know via comments below.

So let's get started.

Hosts:
fed1 = 10.x.x.241
fed2 = 10.x.x.240

Versions (Check the kubernetes / etcd version after installing the packages):

Now the two servers are set up to kick off a sample application. In this case, we'll deploy a web server to fed2. Start off by making a file in roots home directory on fed1 called apache.json that looks as such:

This json file is describing the attributes of the application environment. For example, it is giving it an "id", "name", "ports", and "image". Since the fedora/apache images doesn't exist in our environment yet, it will be pulled down automatically as part of the deployment process. I have seen errors though where kubernetes was looking for a cached image. In that case I did a manual "docker pull fedora/apache" and that seemed to resolve.
For more information about which options can go in the schema, check out the docs on the kubernetes github page.

Now, deploy the fedora/apache image via the apache.json file.

# /usr/bin/kubernetes-kubecfg -c apache.json create pods

You can monitor progress of the operations with these commands:
On the master (fed1) -

Of course this just scratches the surface. I recommend you head off to the kubernetes github page and follow the guestbook example. It's a bit more complicated but should expose you to more functionality.

You can play around with other Fedora images by building from Fedora Dockerfiles. Check here at Github.