Last active
July 20, 2025 06:57
-
-
Save Ceald1/a3781e692759cd2ca0a04aa71fcd028e to your computer and use it in GitHub Desktop.
Kubernetes script for kubeadm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt install fish git -y | |
| echo "" | |
| echo "" | |
| echo "" | |
| echo "" | |
| echo "Installing docker...." | |
| curl -fsSL https://get.docker.com -o get-docker.sh | |
| sudo sh get-docker.sh | |
| sudo usermod -a -G docker $(whoami) | |
| echo "" | |
| echo "" | |
| echo "" | |
| echo "installing kubernetes" | |
| sudo apt-get update | |
| # apt-transport-https may be a dummy package; if so, you can skip that package | |
| sudo apt-get install -y apt-transport-https ca-certificates curl gnupg | |
| curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.33/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg | |
| sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg # allow unprivileged APT programs to read this keyring | |
| echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.33/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list | |
| sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list # helps tools such as command-not-found to work correctly | |
| sudo apt-get update | |
| sudo apt-get install -y kubectl | |
| sudo apt-get install -y kubelet kubeadm kubectl | |
| sudo apt-mark hold kubelet kubeadm kubectl | |
| sudo swapoff -a | |
| sudo systemctl enable --now kubelet | |
| echo "" | |
| echo "" | |
| echo "" | |
| echo "configuring for kubeadm..." | |
| echo -n " cgroup_memory=1 cgroup_enable=memory" >> /boot/cmdline.txt | |
| sudo mkdir -p /etc/containerd | |
| containerd config default | sudo tee /etc/containerd/config.toml > /dev/null | |
| echo "you may need to update containerd configuration with: 'enable_unprivileged_ports = true' and 'sandbox_image' set to 'registry.k8s.io/pause:3.9'" | |
| sudo systemctl enable --now containerd | |
| sudo systemctl restart containerd | |
| sudo chsh -s $(which fish) $USER | |
| echo "reboot before running 'kubeadm init' as sudo" | |
| echo "make sure to set up a cronjob for disabling swap and restarting kubelet" | |
| echo "add calico with: 'kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml' for easy networking." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment