offline-kubernetes-install/1-create_k8s.sh
2023-04-26 19:57:49 +08:00

25 lines
600 B
Bash

#!/bin/bash
apiserver="10.0.0.7"
sudo kubeadm init \
--kubernetes-version 1.21.10 \
--control-plane-endpoint "${apiserver}:6443" \
--upload-certs \
--service-cidr=10.96.0.0/12 \
--pod-network-cidr=10.244.0.0/16
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
if [ $(grep -c "kubectl completion bash" /root/.bashrc) -eq 0 ];then
cat <<EOF | sudo tee -a /root/.bashrc
source /usr/share/bash-completion/bash_completion
source <(kubectl completion bash)
EOF
fi
cd flannel && bash install.sh && cd ..