k8s

K8S

安装docker

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine

sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo sed -i 's/$releasever/7/g' /etc/yum.repos.d/docker-ce.repo
sudo yum update -y
sudo yum install yum-utils docker-ce docker-ce-cli containerd.io -y
sudo systemctl start docker

kubaadm 引导初始化K8S集群

1
2
3
4
5
6
kubeadm init --pod-network-cidr 10.244.0.0/16 --control-plane-endpoint  k8s-control-plane-endpoint-vip:6443  --upload-certs  --kubernetes-version=v1.22.1
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
# 允许master节点进行负载
kubectl taint nodes --all node-role.kubernetes.io/master-
vim /etc/kubernetes/manifests/kube-apiserver.yaml
#- --service-node-port-range=1000-32000
1
2
# 加入控制平面
kubeadm join k8s-control-plane-endpoint-vip:6443 --token xxxxxx.xxxxxxxxxxxxxxxx --discovery-token-ca-cert-hash sha256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --control-plane --certificate-key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
阅读更多