Skip to content

Instantly share code, notes, and snippets.

@kkbruce
kkbruce / SetupK8sEnv.sh
Last active May 30, 2024 23:34
Kubernetes Cluster安裝前執行環境準備。(僅在Ubuntu 22.04測試過)
#!/bin/bash
echo "[Step 1] Disable and turn off SWAP"
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#before-you-begin
# 文件最後一行:Swap disabled. You **MUST** disable swap in order for the kubelet to work properly.
# K8s需要關閉swap
# 先手動關閉
swapoff -a
# 將fstab裡的swap那一行註解
sed -i '/swap/s/^/#/' /etc/fstab