How to install latest production-level Kubernetes in Ubuntu 14
I have had some fun with this :-)
So, Kubernetes 1.6.4 on Ubuntu 14.04 (Trusty):
- have
nsenter
built & installed (nsenter
is a hardkubelet
dependency and is not present in 14.04) - patch up the
kubelet
andkubeadm
packages to remove the systemd dependency (and repace it with anupstart
script) - start
kubelet
manually duringkubeadm init
(becausekubeadm
only supports the systemd-style init system)
I've created a proof of concept script to the above. It's available at:https://gist.github.com/lenartj/0b264cb70e6cb50dfdef37084f892554#file-trusty-kubernetes-sh
You can follow the official guide installing kubeadm and creating the cluster. Just skip the kubeadm
and kubelet
installation steps and use the script above instead.
There is a demo at: https://asciinema.org/a/124160
The steps are:
- Install docker:
curl -sSL https://get.docker.com/ | sh
- Install apt-transport-https:
apt-get update && apt-get install -y apt-transport-https
- Add kubernetes repository key:
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key a
- Add kubernetes-xenial repository:
echo 'deb http://apt.kubernetes.io/ kubernetes-xenial main' >/etc/apt/sources.list.d/kubernetes.list
- Install kubectl, kubernetes-cni and dependencies of kubelet:
apt-get install -y kubectl kubernetes-cni binutils ebtables socat
- Run the script to create the kubelet and kubeadm packages and the nsenter binary:
curl -sSL https://gist.github.com/lenartj/0b264cb70e6cb50dfdef37084f892554#file-trusty-kubernetes-sh | bash
- Install the nsenter binary:
cp -v /tmp/tmp.xxxxx/nsenter /usr/local/bin
- Install kubelet and kubeadm packages:
dpkg -i /tmp/tmp.xxxxx/*-patched
- Initialize the master:
kubeadm init
- Start the kubelet (while kubeadm is waiting for the control plane):
service kubelet start
- Configure kubectl admin credentials:
cp /etc/kubernetes/admin.conf $HOME/; chown $(id -u):$(id -g) $HOME/admin.conf; export KUBECONFIG=$HOME/admin.conf
- Install Pod networking (weave-net):
kubectl apply -f https://git.io/weave-kube-1.6
It's not a nice & clean solution but it works.
kubeadm is the way to go. kube-up.sh has been deprecated long back.https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/
You may also want to try https://www.ubuntu.com/containers/kubernetes