请稍等 ...
×

采纳答案成功!

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

pod 报错的问题

老师,您好,问一下这两个pod 是做什么用的?分别在我的两个从服务器节点。
但是他们两个的状态都处于异常,并且我尝试删除他俩,又马上重新生成了。
图片描述

以下是描述信息

kubectl describe pod kube-flannel-ds-rhvg4 -n kube-system

Name:                 kube-flannel-ds-rhvg4
Namespace:            kube-system
Priority:             2000001000
Priority Class Name:  system-node-critical
Node:                 mysql-02/
Labels:               app=flannel
                      controller-revision-hash=6cf56469d7
                      pod-template-generation=1
                      tier=node
Annotations:          <none>
Status:               Pending
IP:                   
IPs:                  <none>
Controlled By:        DaemonSet/kube-flannel-ds
Init Containers:
  install-cni:
    Image:      registry.cn-hangzhou.aliyuncs.com/chand/flannel:v0.14.0
    Port:       <none>
    Host Port:  <none>
    Command:
      cp
    Args:
      -f
      /etc/kube-flannel/cni-conf.json
      /etc/cni/net.d/10-flannel.conflist
    Environment:  <none>
    Mounts:
      /etc/cni/net.d from cni (rw)
      /etc/kube-flannel/ from flannel-cfg (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-h6c9s (ro)
Containers:
  kube-flannel:
    Image:      registry.cn-hangzhou.aliyuncs.com/chand/flannel:v0.14.0
    Port:       <none>
    Host Port:  <none>
    Command:
      /opt/bin/flanneld
    Args:
      --ip-masq
      --kube-subnet-mgr
    Limits:
      cpu:     100m
      memory:  50Mi
    Requests:
      cpu:     100m
      memory:  50Mi
    Environment:
      POD_NAME:       kube-flannel-ds-rhvg4 (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 kube-api-access-h6c9s (ro)
Conditions:
  Type           Status
  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
  kube-api-access-h6c9s:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   Burstable
Node-Selectors:              <none>
Tolerations:                 :NoSchedule op=Exists
                             node.kubernetes.io/disk-pressure:NoSchedule op=Exists
                             node.kubernetes.io/memory-pressure:NoSchedule op=Exists
                             node.kubernetes.io/network-unavailable:NoSchedule op=Exists
                             node.kubernetes.io/not-ready:NoExecute op=Exists
                             node.kubernetes.io/pid-pressure:NoSchedule op=Exists
                             node.kubernetes.io/unreachable:NoExecute op=Exists
                             node.kubernetes.io/unschedulable:NoSchedule op=Exists
Events:                      <none>
[root@mysql-01 kubeimooc]# kubectl describe pod kube-flannel-ds-vf9nt -n kube-system                     
Name:                 kube-flannel-ds-vf9nt
Namespace:            kube-system
Priority:             2000001000
Priority Class Name:  system-node-critical
Node:                 mysql-04/192.168.2.110
Start Time:           Tue, 29 Aug 2023 21:00:54 +0800
Labels:               app=flannel
                      controller-revision-hash=6cf56469d7
                      pod-template-generation=1
                      tier=node
Annotations:          <none>
Status:               Pending
IP:                   192.168.2.110
IPs:
  IP:           192.168.2.110
Controlled By:  DaemonSet/kube-flannel-ds
Init Containers:
  install-cni:
    Container ID:  docker://f014b7899537b840f41ee5aaf204382ea768d17c111cb9720db91651219a447e
    Image:         registry.cn-hangzhou.aliyuncs.com/chand/flannel:v0.14.0
    Image ID:      docker-pullable://registry.cn-hangzhou.aliyuncs.com/chand/flannel@sha256:635d42b8cc6e9cb1dee3da4d5fe8bbf6a7f883c9951b660b725b0ed2c03e6bde
    Port:          <none>
    Host Port:     <none>
    Command:
      cp
    Args:
      -f
      /etc/kube-flannel/cni-conf.json
      /etc/cni/net.d/10-flannel.conflist
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Tue, 29 Aug 2023 22:43:57 +0800
      Finished:     Tue, 29 Aug 2023 22:43:57 +0800
    Ready:          False
    Restart Count:  25
    Environment:    <none>
    Mounts:
      /etc/cni/net.d from cni (rw)
      /etc/kube-flannel/ from flannel-cfg (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-xl6dq (ro)
Containers:
  kube-flannel:
    Container ID:  
    Image:         registry.cn-hangzhou.aliyuncs.com/chand/flannel:v0.14.0
    Image ID:      
    Port:          <none>
    Host Port:     <none>
    Command:
      /opt/bin/flanneld
    Args:
      --ip-masq
      --kube-subnet-mgr
    State:          Waiting
      Reason:       PodInitializing
    Ready:          False
    Restart Count:  0
    Limits:
      cpu:     100m
      memory:  50Mi
    Requests:
      cpu:     100m
      memory:  50Mi
    Environment:
      POD_NAME:       kube-flannel-ds-vf9nt (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 kube-api-access-xl6dq (ro)
Conditions:
  Type              Status
  Initialized       False 
  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
  kube-api-access-xl6dq:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   Burstable
Node-Selectors:              <none>
Tolerations:                 :NoSchedule op=Exists
                             node.kubernetes.io/disk-pressure:NoSchedule op=Exists
                             node.kubernetes.io/memory-pressure:NoSchedule op=Exists
                             node.kubernetes.io/network-unavailable:NoSchedule op=Exists
                             node.kubernetes.io/not-ready:NoExecute op=Exists
                             node.kubernetes.io/pid-pressure:NoSchedule op=Exists
                             node.kubernetes.io/unreachable:NoExecute op=Exists
                             node.kubernetes.io/unschedulable:NoSchedule op=Exists
Events:
  Type     Reason   Age                    From     Message
  ----     ------   ----                   ----     -------
  Warning  BackOff  110s (x486 over 106m)  kubelet  Back-off restarting failed container

下边是其中一个pod的日志,以及它所在的从节点上 使用的docker ps,但是我不知道哪个是这个pod 的所对应的容器

[root@mysql-01 kubeimooc]# kubectl logs  kube-flannel-ds-vf9nt  -n kube-system        
Error from server (BadRequest): container "kube-flannel" in pod "kube-flannel-ds-vf9nt" is waiting to start: PodInitializing
[root@mysql-04 ~]# docker ps
CONTAINER ID        IMAGE                                                                                                                        COMMAND                  CREATED             STATUS              PORTS               NAMES
0c4669b304ec        registry.aliyuncs.com/google_containers/pause:3.6                                                                            "/pause"                 22 hours ago        Up 22 hours                             k8s_POD_kube-flannel-ds-vf9nt_kube-system_38d91a85-6862-4d81-b0cf-fc60f2af17c0_0
96d2e169e78b        eea7b3dcba7e                                                                                                                 "/docker-entrypoin..."   10 days ago         Up 10 days                              k8s_nginx_nginx_test_8082e6d2-3500-40f8-a5de-51336788aefc_0
79ba27372227        registry.aliyuncs.com/google_containers/pause:3.6                                                                            "/pause"                 10 days ago         Up 10 days                              k8s_POD_nginx_test_8082e6d2-3500-40f8-a5de-51336788aefc_0
2b0cdcf77d5d        registry.aliyuncs.com/google_containers/kube-proxy@sha256:ec165529c811ffe51da4f85fcc76e83ddd8a70716bed464c1aae6d85f9b4915a   "/usr/local/bin/ku..."   3 weeks ago         Up 3 weeks                              k8s_kube-proxy_kube-proxy-kprv5_kube-system_3d8a364a-2101-4744-8b0e-57d975d72e94_0
74f369ff161b        registry.aliyuncs.com/google_containers/pause:3.6                                                                            "/pause"                 3 weeks ago         Up 3 weeks                              k8s_POD_kube-proxy-kprv5_kube-system_3d8a364a-2101-4744-8b0e-57d975d72e94_0

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

1回答

暮闲 2023-08-29 23:03:53

同学你好 这个是网络插件 集群里面pod之间通信的基础。

之所以删除了又启动 是因为是通过daemonset 工作负载调度的 会在每个节点调度一个。

从你贴的图中 只能看出启动失败了 可以给我贴一下对应pod 的日志看看吗?

0 回复 有任何疑惑可以回复我~
  • 提问者 慕后端4419857 #1
    老师,您好,我更新了我的提问内容。在最下边的两个代码块是更新内容,您看下。
    回复 有任何疑惑可以回复我~ 2023-08-30 20:02:43
  • 暮闲 回复 提问者 慕后端4419857 #2
    同学你好 从你更新的信息中 可以进一步定位到 是flannel插件在初始化的时候报错了 你的 /etc/cni/net.d 目录下面有内容吗?
    回复 有任何疑惑可以回复我~ 2023-08-30 23:04:13
  • 提问者 慕后端4419857 回复 暮闲 #3
    老师,您好。有文件。
    
    -rw-r--r-- 1 root root 292 8月  18 22:48 10-flannel.conflist
    
    文件内容是:
    {
      "name": "cbr0",
      "cniVersion": "0.3.1",
      "plugins": [
        {
          "type": "flannel",
          "delegate": {
            "hairpinMode": true,
            "isDefaultGateway": true
          }
        },
        {
          "type": "portmap",
          "capabilities": {
            "portMappings": true
          }
        }
      ]
    }
    回复 有任何疑惑可以回复我~ 2023-08-31 19:39:46
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信