Skip to content

Instantly share code, notes, and snippets.

@markswell
Last active December 25, 2023 20:00
Show Gist options
  • Save markswell/7ddb9840cae7370ae69e409f4b654b47 to your computer and use it in GitHub Desktop.
Save markswell/7ddb9840cae7370ae69e409f4b654b47 to your computer and use it in GitHub Desktop.
It's a default install Kubernetes k8s script
#!/bin/bash
sudo apt update
sudo apt install -y docker.io
sudo usermod -aG docker $USER
sudo reboot
sudo apt-get install -y apt-transport-https ca-certificates curl gpg
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt update
sudo apt install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
sudo swapoff -a
sudo sed -i '/ swap / s/^/#/' /etc/fstab
sudo ufw enable
sudo ufw allow 22/tcp
sudo ufw allow 22/udp
sudo ufw allow 6443/tcp
sudo ufw allow 2379/tcp
sudo ufw allow 2380/tcp
sudo ufw allow 10250/tcp
sudo ufw allow 10251/tcp
sudo ufw allow 10252/tcp
sudo apt install openssh-server
@markswell
Copy link
Author

After run this script we need config th network to get a fixed IP number, by default a edit the yml file in /etc/netplan/ and then use comand sudo netplan apply && netplan restart like seen on this tutorial.

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