1. Docker Install

  • Get Docker GPG Key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  • Add Docker repository
sudo add-apt-repository "deb [arch=amd64]https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) \
    stable"
  • Update your packages
sudo apt-get update
  • Install Docker
sudo apt-get install -y docker-ce=18.06.1~ce~3-0~ubuntu
  • Hold them at current version
sudo apt-mark hold docker-ce

2. Kubernetes Install

  • Get Kubernetes GPG Key:
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
  • Add Kubernetes Repo:
cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
  • Update your packages
sudo apt-get update
  • Install Kubernetes components
sudo apt-get install -y kubelet=1.13.5-00 kubeadm=1.13.5-00 kubectl=1.13.5-00
  • Hold them at current version
sudo apt-mark hold kubelet kubeadm kubectl

3. Prepare host

  • Disable swap memory:
sudo swapoff -a
  • Give unique hostnames to each node:
sudo hostnamectl set-hostname master-node

4. Initialize Cluster

  • Run following command as sudo on the master node:
sudo kubeadm init --pod-network-cidr=10.244.0.0/16

The process might take a minute or more depending on your internet connection

  • Setup local kubeconfig:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
  • Install Antrea CNI network overlay:
kubectl apply -f https://raw.githubusercontent.com/vmware-tanzu/antrea/master/build/yamls/antrea.yml

Alternatively, you can install flannel:

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

5. Setup Node to join cluster

sudo kubeadm join [your unique string from the kubeadm init command]

6. Verification

kubectl get nodes
kubectl cluster-info
kubectl config view
kubectl describe nodes
kubectl describe pods
kubectl get services --all-namespaces
kubectl get pods --all-namespaces
kubectl api-resources -o wide

Command References | Commands | Description | | :—————————————- |:———————————– | | kubectl get nodes | Get all nodes | | kubectl cluster-info | View address of master and services | | kubectl config view | Show kubeconfig settings | | kubectl describe nodes | Show all nodes details | | kubectl describe pods | Show all pods details | | kubectl get services –all-namespaces | Show all services | | kubectl get pods –all-namespaces | Show all pods in all namespaces | | kubectl api-resources -o wide | View all resources |