# modprobe br_netfilter #不执行会报错sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-ip6tables: No such file or directory # sysctl -p /etc/sysctl.d/Kubernetes.conf
安装docker
首先我们配置下docker的镜像源,并修改为腾讯镜像源
1 2
# wget -O /etc/yum.repos.d/docker-ce.repo http://download.docker.com/linux/centos/docker-ce.repo # sed -i 's+download.docker.com+mirrors.cloud.tencent.com/docker-ce+'/etc/yum.repos.d/docker-ce.repo
docker tag ccr.ccs.tencentyun.com/niewx-k8s/kube-controller-manager:v1.20.0 k8s.gcr.io/kube-controller-manager:v1.20.0 docker tag ccr.ccs.tencentyun.com/niewx-k8s/kube-apiserver:v1.20.0 k8s.gcr.io/kube-apiserver:v1.20.0 docker tag ccr.ccs.tencentyun.com/niewx-k8s/kube-scheduler:v1.20.0 k8s.gcr.io/kube-scheduler:v1.20.0 docker tag ccr.ccs.tencentyun.com/niewx-k8s/etcd:3.4.13-0 k8s.gcr.io/etcd:3.4.13-0 docker tag ccr.ccs.tencentyun.com/niewx-k8s/coredns:1.7.0 k8s.gcr.io/coredns:1.7.0 docker tag ccr.ccs.tencentyun.com/niewx-k8s/pause:3.2 k8s.gcr.io/pause:3.2 docker tag ccr.ccs.tencentyun.com/niewx-k8s/kube-proxy:v1.20.0 k8s.gcr.io/kube-proxy:v1.20.0 docker tag ccr.ccs.tencentyun.com/niewx-k8s/flannel:v0.13.1-rc1 quay.io/coreos/flannel:v0.13.1-rc1 docker tag ccr.ccs.tencentyun.com/niewx-k8s/dashboard:v2.0.0-rc7 kubernetesui/dashboard:v2.0.0-rc7 docker tag ccr.ccs.tencentyun.com/niewx-k8s/metrics-scraper:v1.0.4 kubernetesui/metrics-scraper:v1.0.4
# wget https://www.tx97106.com/resource/kube-flannel.yml # kubectl apply -f kube-flannel.yml podsecuritypolicy.policy/psp.flannel.unprivileged created clusterrole.rbac.authorization.k8s.io/flannel created clusterrolebinding.rbac.authorization.k8s.io/flannel created serviceaccount/flannel created configmap/kube-flannel-cfg created daemonset.apps/kube-flannel-ds created
检查集群状态
1 2 3 4 5 6 7 8 9 10 11 12 13
[root@master~]# kubectl get node NAME STATUS ROLES AGE VERSION masterReady control-plane,master45h v1.20.0
[root@master~]# kubectl get pod -A NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-74ff55c5b-qt54q 1/1 Running 045h kube-system etcd-master1/1 Running 045h kube-system kube-apiserver-master1/1 Running 045h kube-system kube-controller-manager-master1/1 Running 045h kube-system kube-flannel-ds-7mjg5 1/1 Running 045h kube-system kube-proxy-j22z7 1/1 Running 045h kube-system kube-scheduler-master1/1 Running 045h
[root@master~]# kubectl get pod -o wide NAME READY STATUS RESTARTS AGE IP NODENOMINATEDNODEREADINESS GATES debug-5b5bbcbb44-v9tl4 1/1 Running 095s10.244.0.8master<none> <none>