Add common script.
This commit is contained in:
commit
33514d8a4e
|
@ -0,0 +1,53 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
cat << "EOF"
|
||||
_ _ _ _
|
||||
(_) (_) | | | |
|
||||
_ __ _ __ _ _ __ _ | |_ __| | ___ __ __
|
||||
| | / _` | / _` | | '__| | | | __| / _` | / _ \ \ \ / /
|
||||
| | | (_| | | (_| | | | | | | |_ _ | (_| | | __/ \ V /
|
||||
| | \__,_| \__, | |_| |_| \__| (_) \__,_| \___| \_/
|
||||
_/ | __/ |
|
||||
|__/ |___/
|
||||
|
||||
Kubernetes Setup Script for All Nodes
|
||||
EOF
|
||||
|
||||
|
||||
# Set Kubernetes version
|
||||
K8S_VERSION="1.29.0-1.1"
|
||||
|
||||
# Update package index and install dependencies
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release
|
||||
|
||||
# Disable swap
|
||||
sudo swapoff -a
|
||||
sudo sed -i '/ swap / s/^/#/' /etc/fstab
|
||||
|
||||
# Configure kernel parameters
|
||||
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
|
||||
overlay
|
||||
br_netfilter
|
||||
EOF
|
||||
|
||||
sudo modprobe overlay
|
||||
sudo modprobe br_netfilter
|
||||
|
||||
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
|
||||
net.bridge.bridge-nf-call-iptables = 1
|
||||
net.ipv4.ip_forward = 1
|
||||
net.bridge.bridge-nf-call-ip6tables = 1
|
||||
EOF
|
||||
|
||||
sudo sysctl --system
|
||||
|
||||
# Add Kubernetes apt repository
|
||||
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
|
||||
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
|
||||
|
||||
# Install kubeadm, kubelet, and kubectl
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y kubelet=$K8S_VERSION kubeadm=$K8S_VERSION kubectl=$K8S_VERSION
|
||||
sudo apt-mark hold kubelet kubeadm kubectl
|
Loading…
Reference in New Issue