
This PS makes the init of the KubeADM environment more stable by ensuring all kube-system pods are up before trying to launch tiller. the NFS PVC provider is now made optional but enabled by default, so that Ceph (and other more complex providers) can be supported in future. Finaly the scripts to bring up k8s/helm are refined to not bring in the clients if already present with the correct versions on the host. Change-Id: I4d7ceb6196e8fd5e3350ec99f09fbe6bb5fe01f6
91 lines
3.6 KiB
Docker
91 lines
3.6 KiB
Docker
FROM ubuntu:16.04
|
|
MAINTAINER pete.birley@att.com
|
|
|
|
ENV HELM_VERSION=v2.3.0 \
|
|
KUBE_VERSION=v1.6.4 \
|
|
CNI_VERSION=v0.5.2 \
|
|
container="docker" \
|
|
DEBIAN_FRONTEND="noninteractive"
|
|
|
|
RUN set -x \
|
|
&& TMP_DIR=$(mktemp --directory) \
|
|
&& cd ${TMP_DIR} \
|
|
&& apt-get update \
|
|
&& apt-get install -y \
|
|
apt-transport-https \
|
|
ca-certificates \
|
|
curl \
|
|
# Add Kubernetes repo
|
|
&& curl -sSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
|
|
&& echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list \
|
|
&& apt-get update \
|
|
&& apt-get install -y \
|
|
docker.io \
|
|
iptables \
|
|
kubectl \
|
|
kubelet \
|
|
kubernetes-cni \
|
|
# Install Kubeadm without running postinstall script as it expects systemd to be running.
|
|
&& apt-get download kubeadm \
|
|
&& dpkg --unpack kubeadm*.deb \
|
|
&& mv /var/lib/dpkg/info/kubeadm.postinst /opt/kubeadm.postinst \
|
|
&& dpkg --configure kubeadm \
|
|
&& apt-get install -yf kubeadm \
|
|
&& mkdir -p /etc/kubernetes/manifests \
|
|
# Install kubectl:
|
|
&& curl -sSL https://dl.k8s.io/${KUBE_VERSION}/kubernetes-client-linux-amd64.tar.gz | tar -zxv --strip-components=1 \
|
|
&& mv ${TMP_DIR}/client/bin/kubectl /usr/bin/kubectl \
|
|
&& chmod +x /usr/bin/kubectl \
|
|
# Install kubelet & kubeadm binaries:
|
|
# (portdirect) We do things in this weird way to let us use the deps and systemd
|
|
# units from the packages in the .deb repo.
|
|
&& curl -sSL https://dl.k8s.io/${KUBE_VERSION}/kubernetes-server-linux-amd64.tar.gz | tar -zxv --strip-components=1 \
|
|
&& mv ${TMP_DIR}/server/bin/kubelet /usr/bin/kubelet \
|
|
&& chmod +x /usr/bin/kubelet \
|
|
&& mv ${TMP_DIR}/server/bin/kubeadm /usr/bin/kubeadm \
|
|
&& chmod +x /usr/bin/kubeadm \
|
|
# Install CNI:
|
|
&& CNI_BIN_DIR=/opt/cni/bin \
|
|
&& mkdir -p ${CNI_BIN_DIR} \
|
|
&& cd ${CNI_BIN_DIR} \
|
|
&& curl -sSL https://github.com/containernetworking/cni/releases/download/$CNI_VERSION/cni-amd64-$CNI_VERSION.tgz | tar -zxv --strip-components=1 \
|
|
&& cd ${TMP_DIR} \
|
|
# Move kubelet binary as we will run containerised
|
|
&& mv /usr/bin/kubelet /usr/bin/kubelet-real \
|
|
# Install helm binary
|
|
&& curl -sSL https://storage.googleapis.com/kubernetes-helm/helm-${HELM_VERSION}-linux-amd64.tar.gz | tar -zxv --strip-components=1 \
|
|
&& mv ${TMP_DIR}/helm /usr/bin/helm \
|
|
# Install openstack-helm dev utils
|
|
&& apt-get install -y \
|
|
make \
|
|
git \
|
|
vim \
|
|
jq \
|
|
# Install nfs utils for development PVC provisioner
|
|
nfs-common \
|
|
# Tweak Systemd units and targets for running in a container
|
|
&& find /lib/systemd/system/sysinit.target.wants/ ! -name 'systemd-tmpfiles-setup.service' -type l -exec rm -fv {} + \
|
|
&& rm -fv \
|
|
/lib/systemd/system/multi-user.target.wants/* \
|
|
/etc/systemd/system/*.wants/* \
|
|
/lib/systemd/system/local-fs.target.wants/* \
|
|
/lib/systemd/system/sockets.target.wants/*udev* \
|
|
/lib/systemd/system/sockets.target.wants/*initctl* \
|
|
/lib/systemd/system/basic.target.wants/* \
|
|
# Clean up apt cache
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
# Clean up tmp dir
|
|
&& cd / \
|
|
&& rm -rf ${TMP_DIR}
|
|
|
|
# Load assets into place, setup startup target & units
|
|
COPY ./assets/ /
|
|
RUN set -x \
|
|
&& ln -s /usr/lib/systemd/system/container-up.target /etc/systemd/system/default.target \
|
|
&& mkdir -p /etc/systemd/system/container-up.target.wants \
|
|
&& ln -s /usr/lib/systemd/system/kubeadm-aio.service /etc/systemd/system/container-up.target.wants/kubeadm-aio.service
|
|
|
|
VOLUME /sys/fs/cgroup
|
|
|
|
CMD /kubeadm-aio
|