I set this up as a quick and dirty lab environment to test a few things for a customer using t2.micro instances on AWS. This is not a supported configuration since the t2.micro instances only have a single processor. One thing not mentioned here is the security policy between the nodes. Kubernetes will require the following ports in order to function:

Master Nodes:

Protocol Direction Port Range Purpose Used By
TCP Inbound 6443 Kubernetes API Server All
TCP Inbound 2379-2380 etcd server client API kube-apiserver, etcd
TCP Inbound 10250 Kubelet API Self, Control plane
TCP Inbound 10251 kube-scheduler Self
TCP Inbound 10252 kube-controller-manager Self

Worker Nodes:

Protocol Direction Port Range Purpose Used By
TCP Inbound 10250 Kubelet API Self, Control Plane
TCP Inbound 30000 - 32767 NodePort Services (Default) All

Configuration

After you have your instances online configure a static IP at /etc/network/interfaces for your secondary / host only NIC.

1
2
3
4
auto eth1
iface eth1 inet static
address 172.31.230.11
netmask 255.255.255.0

Then add Docker’s official GPG key

1
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the stable repository for Docker

1
2
3
4
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

Update Sources & Install Docker

At the time of this writing 18.06.1 is the most current version of Docker Kubernetes will support.

1
2
sudo apt-get update
apt-get install docker-ce=18.06.1~ce~3-0~ubuntu

Install Kubernetes

1
2
3
4
5
6
7
8
apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl

Configure Kubeadm Master node using Flannel for networking. Flannel requires the pod network CIDR in the command below.

1
kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=172.31.230.11

Apply the Flannel network policy.

1
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube-flannel.yml

Join nodes to master by running the command below. You should receive the full command as output after running kubeadm init which you can just copy.

1
kubeadm join 172.31.230.11:6443 --token <your token> --discovery-token-ca-cert-hash <your hash>

After running the join command run:

1
kubectl get nodes

You should see the nodes you successfully joined from above.