抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

k8s 学习总结

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 很多POD处于evicted状态 12345#!/bin/bashfor pod in $(kubectl get pods|grep Evicted|awk '{print ...

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