部署CNI网络问题排查

IT
IT
IT
285
文章
1
评论
2020年5月29日15:40:08 评论 173 3601字阅读12分0秒

创建flannel网络时,一直卡着不动。

[root@k8s-master1 ~]# kubectl get pod -n kube-system
NAME                          READY   STATUS     RESTARTS   AGE
kube-flannel-ds-amd64-96v9n   0/1     Init:0/1   0          7m44s
kube-flannel-ds-amd64-nbx8g   0/1     Init:0/1   0          7m44s

查看pod详细信息

[root@k8s-master1 ~]#  kubectl describe pod kube-flannel-ds-amd64-96v9n -n kube-system
Name:         kube-flannel-ds-amd64-96v9n
Namespace:    kube-system
Priority:     0
Node:         k8s-node2/10.10.0.246
Start Time:   Fri, 29 May 2020 14:58:39 +0800
Labels:       app=flannel
              controller-revision-hash=67f65bfbc7
              pod-template-generation=1
              tier=node
Annotations:  <none>
Status:       Pending
IP:           10.10.0.246
IPs:
  IP:           10.10.0.246
Controlled By:  DaemonSet/kube-flannel-ds-amd64
Init Containers:
  install-cni:
    Container ID:
    Image:         quay.io/coreos/flannel:v0.11.0-amd64
    Image ID:
    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:       PodInitializing
    Ready:          False
    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-js9z8 (ro)
Containers:
  kube-flannel:
    Container ID:
    Image:         quay.io/coreos/flannel:v0.11.0-amd64
    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-amd64-96v9n (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-js9z8 (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
  flannel-token-js9z8:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  flannel-token-js9z8
    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               <unknown>             default-scheduler   Successfully assigned kube-system/kube-flannel-ds-amd64-96v9n to k8s-node2
  Warning  FailedCreatePodSandBox  13s (x16 over 7m50s)  kubelet, k8s-node2  Failed create pod sandbox: rpc error: code = Unknown desc = failed pulling image "k8s.gcr.io/pause:3.1": Error response from daemon: Get https://k8s.gcr.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
[root@k8s-master1 ~]#

可以看出是不能下载镜像导致

  • 下载所需镜像
[root@k8s-node2 ~]# docker pull registry.cn-beijing.aliyuncs.com/zhoujun/pause:3.1
3.1: Pulling from zhoujun/pause
7675586df687: Pull complete
Digest: sha256:fcaff905397ba63fd376d0c3019f1f1cb6e7506131389edbcb3d22719f1ae54d
Status: Downloaded newer image for registry.cn-beijing.aliyuncs.com/zhoujun/pause:3.1
[root@k8s-node2 ~]# docker tag registry.cn-beijing.aliyuncs.com/zhoujun/pause:3.1  k8s.gcr.io/pause:3.1
  • 查看flannel的pod创建情况,等待到所有node节点上的flannel pod都处于running状态后表示cni部署完成
[root@k8s-master1 ~]# kubectl get pods -n kube-system -o wide
NAME                          READY   STATUS    RESTARTS   AGE   IP            NODE        NOMINATED NODE   READINESS GATES
kube-flannel-ds-amd64-96v9n   1/1     Running   0          40m   10.10.0.246   k8s-node2   <none>           <none>
kube-flannel-ds-amd64-nbx8g   1/1     Running   0          40m   10.10.0.245   k8s-node1   <none>           <none>
  • 参考地址 https://blog.csdn.net/qq_24923725/article/details/82910793
继续阅读
  • 我的QQ
  • QQ扫一扫
  • weinxin
  • 我的头条
  • 头条扫一扫
  • weinxin
IT
  • 本文由 发表于 2020年5月29日15:40:08
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
二进制部署K8S-v1.16版本 二进制

二进制部署K8S-v1.16版本

Kubernetes是什么 Kubernetes是Google在2014年开源的一个容器集群管理系统,Kubernetes简称K8S。 K8S用于容器化应用程序的部署、扩展和管理 K8S提供了容器编排...