OpenShift Origin on LXD on Ubuntu

I recently went to a Red Hat OpenShift conference, and was really impressed by the ease of CI/CD using OpenShift. However, being the unprofessional and money/resource-saving individual I am, I decided that I don’t want to buy a RHEL subscription to OpenShift and run this in an “enterprise” configuration.

Instead, I wanted to use my existing dedicated server running Ubuntu Server 16.04 to install an OpenShift Master and a Node. All the official docs insist you use a Red Hat based distro, but:

  • I didn’t want to use virtualization, because that wastes resources (doesn’t make very efficient use of disk space or especially RAM).
  • I didn’t want to use a separate server, because that would cost money.

“Well,” I thought to myself, “Couldn’t I install a CentOS 7 image on LXD with sufficient privileges to run Docker containers within it, and make that my OpenShift cluster, hoping Red Hat would be none the wiser that it’s running on an Ubuntu host?”

Yes. Yes, I could, and yes, OpenShift was blissfully unaware that its host OS is extremely Canonical-y. And that’s exactly how I did it.

This guide can basically be followed verbatim, provided that first you:

  • Install selinux-basic package on the host Ubuntu,
  • Create a new LXD container with public Internet access running CentOS 7.2 or later,
  • Set security.nesting to true
  • Apply the “docker” profile to it, and
  • Make the container privileged (the latter may not strictly be necessary, but I didn’t want to push my luck).
  • I didn’t detail how to set up LXD from scratch, but if you haven’t done so, do that first. This was tested with LXD 2.12 and is not terribly likely to work on LXD < 2.0.

There are specific commands telling you how to set security.testing, make your container privileged, and apply the docker profile, all located here.

In about 5 minutes you can be up and running with OpenShift, having one master, one node, and an etcd. You can then create projects and pods and away you go!

This is a nice example of Canonical, Red Hat, and Docker, Inc. technology playing nicely together.

3 Likes

how did you get past the devicemapper issue?
I cannot get docker to run inside the lxd container.
docker is version 1.12 for centos7
this requires devicemapper storage config
which requires a separate block device.
at this point I got stuck since I dont have the block device in the centos7 container…