Last active
January 16, 2020 04:40
-
-
Save vaayne/043226626c1e7987613b9b5e7ea7bbaa to your computer and use it in GitHub Desktop.
Init kubeadm env for Ubuntu 18.04
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/sh | |
echo "Install Docker" | |
curl -fsSL https://get.docker.com -o get-docker.sh | |
sh get-docker.sh | |
# 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 restart docker | |
echo "Install kubenetes tools" | |
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 | tee /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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For non root user, just run
sudo kubeadm_init_install.sh