请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

master ,node1安装后重新启动master,node1,node2机器

图片描述图片描述

图片描述

我初始化的脚本
kubeadm init --kubernetes-version=1.19.3
–apiserver-advertise-address=192.168.42.101
–image-repository registry.aliyuncs.com/google_containers
–service-cidr=10.1.0.0/16
–pod-network-cidr=10.244.0.0/16
在安装master节点中,我也执行过https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml 主要是dns一直pending,执行了就是正常的了。
第一遍安
装都成功了,后面我就关了vwware虚拟机,重新开启master, node1,node2 3台虚拟机。kubectl get nodes是正常的。kubectl get pods -n kube-system就发现上面的3个pod运行不正常了。

正在回答 回答被采纳积分+3

1回答

清风 2023-04-10 07:39:01

再执行https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml 一下

0 回复 有任何疑惑可以回复我~
  • 执行了。还是一个样,kube-flannel.yml 是直接下载到我本地电脑的。
    [root@master ~]# kubectl apply -f kube-flannel.yml 
    namespace/kube-flannel unchanged
    clusterrole.rbac.authorization.k8s.io/flannel unchanged
    clusterrolebinding.rbac.authorization.k8s.io/flannel unchanged
    serviceaccount/flannel unchanged
    configmap/kube-flannel-cfg unchanged
    daemonset.apps/kube-flannel-ds unchanged
    [root@master ~]# kubectl get pods -n kube-system
    NAME                             READY   STATUS             RESTARTS   AGE
    
    
    kube-flannel-ds-62m76            0/1     Error              100        30h
    kube-flannel-ds-v6rb4            0/1     CrashLoopBackOff   55         26h
    kube-flannel-ds-z5kbh            0/1     CrashLoopBackOff   51         26h
    kube-proxy-4wmls                 1/1     Running            9          31h
    回复 有任何疑惑可以回复我~ 2023-04-10 19:14:13
  • kubectl logs kube-flannel-ds-z5kbh -n kube-system
    I0410 17:14:19.196662       1 main.go:518] Determining IP address of default interface
    I0410 17:14:19.290534       1 main.go:531] Using interface with name ens33 and address 192.168.42.103
    I0410 17:14:19.290662       1 main.go:548] Defaulting external address to interface address (192.168.42.103)
    W0410 17:14:19.290688       1 client_config.go:517] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
    E0410 17:14:19.396445       1 main.go:243] Failed to create SubnetManager: error retrieving pod spec for 'kube-system/kube-flannel-ds-z5kbh': pods "kube-flannel-ds-z5kbh" is forbidden: User "system:serviceaccount:kube-system:flannel" cannot get resource "pods" in API group "" in the namespace "kube-system"
    回复 有任何疑惑可以回复我~ 2023-04-10 19:18:28
  • 清风 回复 提问者 qq_金融超越战_03665934 #3
     执行
    kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel-rbac.yml
    kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
    回复 有任何疑惑可以回复我~ 2023-04-17 15:42:32
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信