Skip to content

Instantly share code, notes, and snippets.

@initcron
Last active March 28, 2024 02:41
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 29 You must be signed in to fork a gist
  • Save initcron/40b71211cb693f541ce35fe3fb1adb11 to your computer and use it in GitHub Desktop.
Save initcron/40b71211cb693f541ce35fe3fb1adb11 to your computer and use it in GitHub Desktop.
kubernetes user data script
#!/bin/bash
apt-get update
apt-get install -y git wget
# Install Docker
apt-get install -yq \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
apt-get install -yq docker-ce docker-ce-cli containerd.io
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo cat <<EOF > /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update -y
sudo apt-get install -y kubelet kubeadm kubectl kubernetes-cni nfs-common
# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo sysctl net.bridge.bridge-nf-call-iptables=1
sudo swapoff -a
sudo rm -rf /var/lib/kubelet/*
sudo apt-get install nfs-common -y
@MeenachiSundaram
Copy link

Updated the copy of my fork
faced issue in GCP instance for docker installation, modification done and it helps

@initcron
Copy link
Author

initcron commented Nov 4, 2019 via email

@luliv
Copy link

luliv commented Nov 6, 2019 via email

@shivakumarhn
Copy link

Hi Gaurav

Could you please share the script for Centos 7 to set up kubernetes in case if you have??

Thanks
Shiva

@luliv
Copy link

luliv commented Mar 3, 2020 via email

@desmondvoon
Copy link

able to have arch linux

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