Skip to content

Instantly share code, notes, and snippets.

@jreypo
Created December 2, 2019 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jreypo/8264157231a649fe4d65762917d6a27f to your computer and use it in GitHub Desktop.
Save jreypo/8264157231a649fe4d65762917d6a27f to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Script to install Docker and Kubeadm in Ubuntu 18.04
#
# Written by Juan Manuel Rey <juanmanuel.reyportal@gmail.com>
# Based on Kubernetes official doc
#
echo "Installing Docker..."
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update && sudo apt-get install -y docker-ce=5:18.09.9~3-0~ubuntu-bionic docker-ce-cli containerd.io
echo "Configuring Docker..."
cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo systemctl daemon-reload
sudo systemctl restart docker
echo "Installing Kubernetes components..."
sudo apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update && sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment