Last active
August 31, 2021 05:25
-
-
Save oilbeater/939fb1bea638b3759f5f0fbf9f1894fc to your computer and use it in GitHub Desktop.
bootstrap k8s
This file contains 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
yum install -y yum-utils | |
yum-config-manager \ | |
--add-repo \ | |
https://download.docker.com/linux/centos/docker-ce.repo | |
yum install -y docker-ce docker-ce-cli containerd.io | |
systemctl enable docker | |
systemctl start docker | |
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo | |
[kubernetes] | |
name=Kubernetes | |
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch | |
enabled=1 | |
gpgcheck=1 | |
repo_gpgcheck=1 | |
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg | |
exclude=kubelet kubeadm kubectl | |
EOF | |
# Set SELinux in permissive mode (effectively disabling it) | |
sudo setenforce 0 | |
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config | |
swapoff -a | |
sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes | |
sudo systemctl enable --now kubelet | |
cat <<EOF | sudo tee kubeadm-config.yaml | |
kind: ClusterConfiguration | |
apiVersion: kubeadm.k8s.io/v1beta3 | |
kubernetesVersion: v1.22.1 | |
--- | |
kind: KubeletConfiguration | |
apiVersion: kubelet.config.k8s.io/v1beta1 | |
cgroupDriver: cgroupfs | |
EOF | |
kubeadm init --config kubeadm-config.yaml | |
mkdir -p $HOME/.kube | |
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | |
sudo chown $(id -u):$(id -g) $HOME/.kube/config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment