在部署metrics server后,pod启动成功,但是使用kubectl top node命令时,显示报错: Error from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io) 多方查看后,发现在master节点上ping不同metrics server的podIP。两天的排错,才发现是使用calico网络bgp模式后,不同网段之间通信,pod不通 这里重新生成calico的ippool,使用calico网络的crosssubnet网络实现
# 1、备份当前的ippool calicoctl get ippool -o yaml > pool_bak.yaml # 2、修改pool_bak.yaml #----在 natOutgoing: true后面添加一行,关闭该ippool disabled: true # 3、应用使生效 calicoctl apply -f pool_bak.yaml # 4、查看ippool calicoctl get ippool -o wide # ***如下显示 # --NAME CIDR NAT IPIPMODE DISABLED # default-ipv4-ippool 10.66.0.0/16 true Never true # **** # 5、删除旧的ippool calicoctl delete pool default-ipv4-ippool # 6、新建新的ippool calicoctl create -f -<<EOF apiVersion: projectcalico.org/v3 kind: IPPool metadata: name: new-pool spec: cidr: 10.67.0.0/16 ipipMode: CrossSubnet natOutgoing: true EOF # 7、查看新的ippool # NAME CIDR NAT IPIPMODE DISABLED # new-pool 10.66.0.0/16 true CrossSubnet false然后将metrics server等pods重新生成,就可以解决问题啦
BINGO BINGO BINGO BINGO