当前位置: 首页 > 知识库问答 >
问题:

在Kubernetes安装期间,Flannel网络出现故障,请建议如何修复此问题

李俊雅
2023-03-14

我尝试了以下步骤在Ubuntu上安装kubernetes master。

https://www.techrepublic.com/article/how-to-quickly-install-kubernetes-on-ubuntu/#postComments

在部署pod网络阶段:sudo kubectl apply-fhttps://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.ymlsudo kubectl应用-fhttps://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml

容器被创建。但是,法兰绒容器正在失败。uday@k8s-大师:~$sudo kubectl获得播客——所有名称空间

NAMESPACE     NAME                                 READY   STATUS              RESTARTS   AGE
kube-system   coredns-6955765f44-jkpvd             0/1     ContainerCreating   0          15m
kube-system   coredns-6955765f44-rf6fs             0/1     ContainerCreating   0          15m
kube-system   etcd-k8s-master                      1/1     Running             0          15m
kube-system   kube-apiserver-k8s-master            1/1     Running             0          15m
kube-system   kube-controller-manager-k8s-master   1/1     Running             0          15m
kube-system   kube-flannel-ds-amd64-g8s4z          0/1     CrashLoopBackOff    7          13m
kube-system   kube-proxy-mzwdj                     1/1     Running             0          15m
kube-system   kube-scheduler-k8s-master            1/1     Running             0          15m

当我描述豆荚时:uday@k8s-船长:~$kubectl描述kube-flannel-ds-amd64-g8s4z-n kube系统

Name:         kube-flannel-ds-amd64-g8s4z
Namespace:    kube-system
Priority:     0
Node:         k8s-master/10.0.0.4
Start Time:   Wed, 25 Mar 2020 10:00:56 +0000
Labels:       app=flannel
              controller-revision-hash=776876f95c
              pod-template-generation=1
              tier=node
Annotations:  <none>
Status:       Running
IP:           10.0.0.4
IPs:
  IP:           10.0.0.4
Controlled By:  DaemonSet/kube-flannel-ds-amd64
Init Containers:
  install-cni:
    Container ID:  docker://0b011d6cc4a2e21514c953ea4c874ebc9c3218fd69b8284fbbbc90b94531db8d
    Image:         quay.io/coreos/flannel:v0.12.0-amd64
    Image ID:      docker-pullable://quay.io/coreos/flannel@sha256:6d451d92c921f14bfb38196aacb6e506d4593c5b3c9d40a8b8a2506010dc3e10
    Port:          <none>
    Host Port:     <none>
    Command:
      cp
    Args:
      -f
      /etc/kube-flannel/cni-conf.json
      /etc/cni/net.d/10-flannel.conflist
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Wed, 25 Mar 2020 10:01:08 +0000
      Finished:     Wed, 25 Mar 2020 10:01:08 +0000
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /etc/cni/net.d from cni (rw)
      /etc/kube-flannel/ from flannel-cfg (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from flannel-token-f5tgn (ro)
Containers:
  kube-flannel:
    Container ID:  docker://b2385667e9ab25842a828795210214934ed9d14aaa4b17ff1947151dbbdee433
    Image:         quay.io/coreos/flannel:v0.12.0-amd64
    Image ID:      docker-pullable://quay.io/coreos/flannel@sha256:6d451d92c921f14bfb38196aacb6e506d4593c5b3c9d40a8b8a2506010dc3e10
    Port:          <none>
    Host Port:     <none>
    Command:
      /opt/bin/flanneld
    Args:
      --ip-masq
      --kube-subnet-mgr
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Wed, 25 Mar 2020 10:12:39 +0000
      Finished:     Wed, 25 Mar 2020 10:12:40 +0000
    Ready:          False
    Restart Count:  7
    Limits:
      cpu:     100m
      memory:  50Mi
    Requests:
      cpu:     100m
      memory:  50Mi
    Environment:
      POD_NAME:       kube-flannel-ds-amd64-g8s4z (v1:metadata.name)
      POD_NAMESPACE:  kube-system (v1:metadata.namespace)
    Mounts:
      /etc/kube-flannel/ from flannel-cfg (rw)
      /run/flannel from run (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from flannel-token-f5tgn (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  run:
    Type:          HostPath (bare host directory volume)
    Path:          /run/flannel
    HostPathType:
  cni:
    Type:          HostPath (bare host directory volume)
    Path:          /etc/cni/net.d
    HostPathType:
  flannel-cfg:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      kube-flannel-cfg
    Optional:  false
  flannel-token-f5tgn:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  flannel-token-f5tgn
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     :NoSchedule
                 node.kubernetes.io/disk-pressure:NoSchedule
                 node.kubernetes.io/memory-pressure:NoSchedule
                 node.kubernetes.io/network-unavailable:NoSchedule
                 node.kubernetes.io/not-ready:NoExecute
                 node.kubernetes.io/pid-pressure:NoSchedule
                 node.kubernetes.io/unreachable:NoExecute
                 node.kubernetes.io/unschedulable:NoSchedule
Events:
  Type     Reason     Age                From                 Message
  ----     ------     ----               ----                 -------
  Normal   Scheduled  15m                default-scheduler    Successfully assigned kube-system/kube-flannel-ds-amd64-g8s4z to k8s-master
  Normal   Pulling    15m                kubelet, k8s-master  Pulling image "quay.io/coreos/flannel:v0.12.0-amd64"
  Normal   Pulled     14m                kubelet, k8s-master  Successfully pulled image "quay.io/coreos/flannel:v0.12.0-amd64"
  Normal   Created    14m                kubelet, k8s-master  Created container install-cni
  Normal   Started    14m                kubelet, k8s-master  Started container install-cni
  Normal   Started    13m (x4 over 14m)  kubelet, k8s-master  Started container kube-flannel
  Normal   Pulled     13m (x5 over 14m)  kubelet, k8s-master  Container image "quay.io/coreos/flannel:v0.12.0-amd64" already present on machine
  Normal   Created    13m (x5 over 14m)  kubelet, k8s-master  Created container kube-flannel
  Warning  BackOff    0s (x68 over 14m)  kubelet, k8s-master  Back-off restarting failed container

请告诉我解决这个问题的步骤。

共有1个答案

方季同
2023-03-14

要使法兰绒正常工作,必须将--pod网络cidr=10.244.0.0/16传递到kubeadm init

应用留档指定的法兰绒yaml:

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml

资料来源:https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#tabs-pod-install-3

要了解更多关于法兰绒的信息,请查看官方的法兰绒Github

 类似资料:
  • 安装flannel网络插件 所有的node节点都需要安装网络插件才能让所有的Pod加入到同一个局域网中,本文是安装flannel网络插件的参考文档。 建议直接使用yum安装flanneld,除非对版本有特殊需求,默认安装的是0.7.1版本的flannel。 yum install -y flannel service配置文件/usr/lib/systemd/system/flanneld.serv

  • 5.3.1. 软盘的可靠性 对于第一次安装 Debian 的人来说,他们遇到的最大的问题很可能是软盘的可靠性。 问题出现最严重的是糟糕的引导软盘,因为他们由硬件直接读出,然后才进入 Linux 引导。很多情况 下,硬件驱动的读取并不能像 Linux 软盘驱动读取那样可靠,并且对于读到错误的数据,它们只是停 止运行并且打印一条错误的消息。驱动软盘的错误只是打印出很多有关的 I/O 错误。 如果你已经

  • 对于第一次安装 Debian 的人来说,他们遇到的最大的问题很可能是软盘的可靠性。 问题出现最严重的是糟糕的引导软盘,因为他们由硬件直接读出,然后才进入 Linux 引导。很多情况 下,硬件驱动的读取并不能像 Linux 软盘驱动读取那样可靠,并且对于读到错误的数据,它们只是停 止运行并且打印一条错误的消息。驱动软盘的错误只是打印出很多有关的 I/O 错误。 如果你已经在特定的软盘上陷入麻烦之中,

  • 5.3.1. 软盘的可靠性 对于第一次安装 Debian 的人来说,他们遇到的最大的问题很可能是软盘的可靠性。 问题出现最严重的是糟糕的引导软盘,因为他们由硬件直接读出,然后才进入 Linux 引导。很多情况 下,硬件驱动的读取并不能像 Linux 软盘驱动读取那样可靠,并且对于读到错误的数据,它们只是停 止运行并且打印一条错误的消息。驱动软盘的错误只是打印出很多有关的 I/O 错误。 如果你已经

  • 我在Pycharm上创建了一个项目,将selenium to文件夹添加到我的新项目“selenium”中,并将chromedriver添加到该文件夹中。 我能做什么?