k8s的组件网络不通问题排查


k8s的组件网络不通问题排查

故障描述

  • 容器内部可以ping到主机
  • 部署metrics-server后,服务启动失败

解决

  • 查看网卡的mtu
[root@k8s-master-01.novalocal 09:27 ~]
# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1450
inet 10.0.3.20 netmask 255.255.255.0 broadcast 10.0.3.255
ether fa:16:3e:e9:63:80 txqueuelen 1000 (Ethernet)
RX packets 100179 bytes 79265288 (75.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 108797 bytes 25954685 (24.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  • 修改calico中的mtu值
[root@k8s-master-01.novalocal 09:29 ~/k8s/calico]
# cat calico_3.4.yaml | more
# Calico Version v3.4.0
# https://docs.projectcalico.org/v3.4/releases#v3.4.0
# This manifest includes the following component versions:
# calico/node:v3.4.0
# calico/cni:v3.4.0

# This ConfigMap is used to configure a self-hosted Calico installation.
kind: ConfigMap
apiVersion: v1
metadata:
name: calico-config
namespace: kube-system
data:
# To enable Typha, set this to "calico-typha" *and* set a non-zero value for Typha replicas
# below. We recommend using Typha if you have more than 50 nodes. Above 100 nodes it is
# essential.
typha_service_name: "none"
# Configure the Calico backend to use.
calico_backend: "bird"

# Configure the MTU to use
veth_mtu: "1430"

# The CNI network configuration to install on each node. The special
# values in this config will be automatically populated.
cni_network_config: |-