k8s dashboard 报错 Error: 'dial tcp 172.168.56.2:9090: getsockopt: connection refused'
访问web (http://192.168.56.101:8080/ui)
Error: 'dial tcp 172.17.26.2:9090: getsockopt: connection refused'
Error: 'dial tcp 172.17.26.2:9090: getsockopt: connection refused'
排查方法:
1、需要检查apiserver的地址设置的是否正确(重启apiserver和kubenets),然后就是flannel是否配置启动
2、配置Kubernetes网络,在master和nodes上都需要安装flannel 检查master和node上配置文件是否一致。
vi /etc/sysconfig/flanneld # Flanneld configuration options # etcd url location. Point this to the server where etcd runs FLANNEL_ETCD_ENDPOINTS="http://192.168.56.101:2379" # etcd config key. This is the configuration key that flannel queries # For address range assignment FLANNEL_ETCD_PREFIX="/atomic.io/network" # Any additional options that you want to pass #FLANNEL_OPTIONS=""
3、检查iptables -L -n ,检查node节点上的FORWARD 查看转发是否是drop,如果是drop,则开启
iptables -P FORWARD ACCEPT
以上命令系统重启后就失效了
或者
echo "net.ipv4.ip_forward = 1" >>/usr/lib/sysctl.d/50-default.conf
cat /usr/lib/sysctl.d/50-default.conf | grep forward
然后在master节点上访问 curl -i http://172.17.26.2:9090 可以访问。