Last active
April 29, 2020 09:06
-
-
Save hamdifourati/2f940556f0ebfd68e932585c557623d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: | |
# curl -s https://gist.githubusercontent.com/hamdifourati/2f940556f0ebfd68e932585c557623d9/raw/kube.sh | sudo bash | |
# | |
set -ex | |
DOCKER_VERSION=18.09.9~3-0 | |
CONTAINERD_VERSION=1.2.10-3 | |
KUBE_VERSION=1.18.2-00 | |
apt update -y | |
apt remove docker docker-engine docker.io containerd runc | |
### Install packages to allow apt to use a repository over HTTPS | |
apt-get update && apt-get -y install apt-transport-https ca-certificates curl software-properties-common | |
### Add Docker’s official GPG key | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - | |
### Add Docker apt repository. | |
add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) \ | |
stable" | |
## Install Docker CE. | |
apt-get update && apt-get -y install containerd.io=${CONTAINERD_VERSION} \ | |
docker-ce=5:${DOCKER_VERSION}~ubuntu-$(lsb_release -cs) \ | |
docker-ce-cli=5:${DOCKER_VERSION}~ubuntu-$(lsb_release -cs) | |
apt-mark hold containerd.io docker-ce docker-ce-cli | |
# Setup daemon. | |
cat > /etc/docker/daemon.json <<EOF | |
{ | |
"exec-opts": ["native.cgroupdriver=systemd"], | |
"log-driver": "json-file", | |
"log-opts": { | |
"max-size": "100m" | |
}, | |
"storage-driver": "overlay2" | |
} | |
EOF | |
mkdir -p /etc/systemd/system/docker.service.d | |
# Restart docker. | |
systemctl daemon-reload | |
systemctl enable docker | |
systemctl restart docker | |
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 | |
# List available versions of kubeadm | |
apt update -y | |
apt-cache madison kubeadm | |
# Install selected version | |
apt-get install -y kubelet=${KUBE_VERSION} kubeadm=${KUBE_VERSION} kubectl=${KUBE_VERSION} | |
apt-mark hold kubelet kubeadm kubectl | |
docker --version | |
kubectl version --client | |
kubeadm version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment