Provisioning scripts for bare-metal kubernets using kubeadm.
These scripts are designed to work on fresh installs of Ubuntu 16.04.
This script takes two parameters:
- Docker version to install.
- URL for a cluster-config.yml file.
It will install the version of docker specified by the firest parameter, and the version of kubernetes binaries specified in the cluster-config.yml file.
# Init the first master with docker version 18.06.1~ce~3-0~ubuntu, specified cluster-config.yaml, and Canal network add-on
curl -fsSL https://raw.githubusercontent.com/jonaskello/metal-kube/master/first-master.sh | bash -s -- 18.06.1~ce~3-0~ubuntu https://raw.githubusercontent.com/jonaskello/metal-kube/master/cluster-config.yamlThis script requires no parameters. It shuold be run on a master node. It will generate a bash command that should be run on the worker node in order to install docker, kubernetes binaries (same vesion as the master node) and join the node to the cluster.
# Run this on a master node to generate a worker provisioning command, then run the generated command on the worker to provision it
curl -fsSL https://raw.githubusercontent.com/jonaskello/metal-kube/master/worker-gen.sh | bashAlternatively, if the worker has ssh access to the master you can run it on the worker:
ssh myuser@mymaster "curl -fsSL https://raw.githubusercontent.com/jonaskello/metal-kube/master/worker-gen.sh | bash" | bashssh myuser@mymaster "curl -fsSL https://raw.githubusercontent.com/jonaskello/metal-kube/master/add-master-get.sh | bash" | bashCopy the certificate files from the first control plane node to the rest:
In the following example, replace CONTROL_PLANE_IPS with the IP addresses of the other control plane nodes.
USER=ubuntu # customizable
CONTROL_PLANE_IPS="10.0.0.7 10.0.0.8"
for host in
Move the files created by the previous step where scp was used:
USER=ubuntu # customizable mkdir -p /etc/kubernetes/pki/etcd mv /home/${USER}/ca.crt /etc/kubernetes/pki/ mv /home/${USER}/ca.key /etc/kubernetes/pki/ mv /home/${USER}/sa.pub /etc/kubernetes/pki/ mv /home/${USER}/sa.key /etc/kubernetes/pki/ mv /home/${USER}/front-proxy-ca.crt /etc/kubernetes/pki/ mv /home/${USER}/front-proxy-ca.key /etc/kubernetes/pki/ mv /home/${USER}/etcd-ca.crt /etc/kubernetes/pki/etcd/ca.crt mv /home/${USER}/etcd-ca.key /etc/kubernetes/pki/etcd/ca.key mv /home/${USER}/admin.conf /etc/kubernetes/admin.conf
sudo kubeadm join 192.168.0.200:6443 --token j04n3m.octy8zely83cy2ts --discovery-token-ca-cert-hash sha256:84938d2a22203a8e56a787ec0c6ddad7bc7dbd52ebabc62fd5f4dbea72b14d1f --experimental-control-plane
To find all versions of kubeadm, kubelet and kubectl (they use the same version number):
curl -s https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-amd64/Packages | grep Version | awk '{print $2}'To find all versions of docker-ce (only works after adding the docker apt-get repo):
apt-cache madison docker-ceIf you want to run kubeadm yourself, you can run the init script to just install docker and the kubernetes binaries. It will install docker and kubernetes binaries that are needed by all nodes, regardless of role (master, worker). Determine which version you want of docker and kubernetes binaries and add them as parameters at the end of the command.
# This will install docker version 18.06.1~ce~3-0~ubuntu and kubernetes binaries version 1.13.4-00
curl -fsSL https://raw.githubusercontent.com/jonaskello/metal-kube/master/init-node.sh | bash -s -- 18.06.1~ce~3-0~ubuntu 1.13.4-00