Skip to content

Instantly share code, notes, and snippets.

@vaayne
Last active January 16, 2020 04:40
Show Gist options
  • Save vaayne/043226626c1e7987613b9b5e7ea7bbaa to your computer and use it in GitHub Desktop.
Save vaayne/043226626c1e7987613b9b5e7ea7bbaa to your computer and use it in GitHub Desktop.
Init kubeadm env for Ubuntu 18.04
#!/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
@vaayne
Copy link
Author

vaayne commented Jan 16, 2020

For non root user, just run sudo kubeadm_init_install.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment