Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
single node docker/Kubernetes setup script, enjoy!
sudo apt-get update
sudo apt-get install -y \
vim \
tmux \
zsh \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
curl -fsSL | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] \
$(lsb_release -cs) \
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli
sudo docker run hello-world
# post install docker
sudo groupadd docker
sudo usermod -aG docker $USER
sudo systemctl enable docker
sudo curl -L`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
./ # without root since it has root
sudo ./
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
# ref
kubectl apply -f
kubectl taint nodes --all
# ref
swapoff -a
cat > /etc/docker/daemon.json <<EOF
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
"storage-driver": "overlay2"
mkdir -p /etc/systemd/system/docker.service.d
# Restart docker.
systemctl daemon-reload
systemctl restart docker
apt-get update && sudo apt-get install -y apt-transport-https curl
curl -s | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb kubernetes-xenial main
apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl
systemctl daemon-reload
systemctl restart kubelet
kubeadm init --apiserver-cert-extra-sans \
--pod-network-cidr= \
--apiserver-bind-port=8443 \

This comment has been minimized.

Copy link
Owner Author

@longkai longkai commented Jan 13, 2020

Github gist file order is sucks....

Just download all files and run ./

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