I’ve written recently about running kubernetes in containers on an atomic host. There are a few different ways to do it, but the simplest method involves fetching and running the Debian-based container provided by the upstream kubernetes project.
Debian is awesome, but I’m team RPM — when I run containerized apps, I tend to base them on CentOS or Fedora. If I can run kubernetes itself from an image based on one of those distros, I can save myself some storage and network transfer up front, and set myself up better to understand what’s going on inside the kubernetes containers.
As it turns out, it was pretty easy to mod the Makefile and Dockerfile that generate the containers. I swapped Debian apt-get specific bits for
yum ones, changed the default baseimage to
centos:centos7, and removed the gcloud-specifc push command.
The script expects to get a freshly-built copy of the all-in-one
hyperkube binary that wraps together all of the kubernetes components from your local system. I modded the Makefile to grab a pre-built (by the kubernetes project) copy of this binary if it doesn’t exist on your machine.
Here’s how to make your own CentOS or Fedora-based kubernetes container, which you can then run using the directions under the heading “Containers from Upstream” from this post:
$ git clone https://github.com/jasonbrooks/kubernetes.git $ git checkout hyperkube-rpm $ cd kubernetes/cluster/images/hyperkube $ make VERSION=v1.3.6
That command would build a CentOS-based hyperkube container, targeting the 1.3.7 release. To build and push to your docker registry, you could use the command:
$ make push VERSION=v1.3.6 REGISTRY="YOUR-DOCKER-REGISTRY"
To build and push a Fedora-based container with the very latest kube beta container, you can bump the
VERSION and add a
$ make push VERSION=v1.4.0-beta.8 REGISTRY="YOUR-DOCKER-REGISTRY" BASEIMAGE=fedora:24
I tested out
v1.4.0-beta.8on CentOS Atomic, but hit this
issue with cAdvisor and cgroups. I clicked the version count back to
v1.3.6, and that worked.