Skip to content

Instantly share code, notes, and snippets.

@yukirii yukirii/capi-vultr-startup-script.sh Secret
Last active Dec 15, 2019

Embed
What would you like to do?
#!/bin/sh
## Wait other apt process
while fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do
echo "Wait other apt process..."
sleep 5
done
## Install required packages
apt-get update && apt-get install -y apt-transport-https \
curl \
ca-certificates \
gnupg-agent \
software-properties-common \
cloud-init
## Install Docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update && apt-get install -y docker-ce docker-ce-cli containerd.io
## Install Kubernetes packages
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
apt-get update && apt-get install -y kubelet=1.17.0-00 kubeadm=1.17.0-00 kubectl=1.17.0-00
apt-mark hold kubelet kubeadm kubectl
## Run cloud-init
cloud-init init --local
cloud-init init
cloud-init modules --mode=config
cloud-init modules --mode=final
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.