Update package index
sudo apt-get update
Install required packages
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
Install docker gpg key then add the docker repository
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable"
Update package index and install specific docker version
sudo apt update
sudo apt-get install -y docker-ce=$(apt-cache madison docker-ce | grep 17.03 | head -1 | awk '{print $3}')
Add ubuntu to docker group and check installed version
sudo adduser ubuntu docker
docker version
Install kubernetes gpg key and add the kubernetes repository
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo add-apt-repository "deb http://apt.kubernetes.io/ kubernetes-$(lsb_release -cs) main"
Update package index and install kubelet, kubeadm and kubectl
sudo apt update
sudo apt install -y kubelet kubeadm kubectl
Check installation
kubelet --version
kubectl version
kubeadm version