Run Single Node Kubernetes Cluster on OpenStack

Running Kubernetes on OpenStack is surprisingly lacking simple HOWTOs. So I just cook one.

While there is a kube-up.sh in Kubernetes that can (supposedly) spin up a Kubernetes cluster on OpenStack, I find the easiest and quickest way is to use local-up-cluster.sh in Kubernetes source tree.

First, spin up a Nova instance on OpenStack and make sure docker, golang, etcd, openssl are installed.

Then following the instruction from OpenStack to get the RC file:

“Download and source the OpenStack RC file

  1. Log in to the dashboard and from the drop-down list select the project for which you want to download the OpenStack RC file.

  2. On the Project tab, open the Compute tab and click Access & Security.

  3. On the API Access tab, click Download OpenStack RC File and save the file. The filename will be of the form PROJECT-openrc.sh where PROJECT is the name of the project for which you downloaded the file.

  4. Copy the PROJECT-openrc.sh file to the computer from which you want to run OpenStack commands. “

Use the OpenStack RC and create your OpenStack cloud config for Kubernetes using the following format


# cat /etc/cloud.conf 
[Global] 
auth-url = 
username =
password =
tenant-name =
region =

The clone the Kubernetes source tree and apply my patch from PR 25750 (if not merged yet)

Then you can spin up a local cluster under Kubernetes source tree using the following command:

# find Nova instance name and override hostname
ALLOW_PRIVILIGED=true CLOUD_PROVIDER=openstack CLOUD_CONFIG=/etc/cloud.conf HOSTNAME_OVERRIDE="rootfs-dev" hack/local-up-cluster.sh

 

Advertisements

Start Single Kubernetes Cluster on AWS EC2


# get a copy of kubernetes source

$ git clone https://github.com/rootfs/kubernetes; cd kubernetes

# put AWS access key id and secret in ~/.aws/credentials like the following
# ~/.aws/credentials 
#[default]
#aws_access_key_id = ......
#aws_secret_access_key = ....

# get the host name from EC2 management console and use host name as override
$ ALLOW_PRIVILEGED=true LOG_LEVEL=5 CLOUD_PROVIDER="aws" HOSTNAME_OVERRIDE="ip-172-18-14-238.ec2.internal" hack/local-up-cluster.sh