lost connection to pod
最近在使用kube-promethues搭建K8s集群监控启动所有pods后,执行如下命令kubectl --address 0.0.0.0 --namespace monitoring port-forward svc/grafana 3000
出现如下问题:
E0303 22:37:30.698827 625081 portforward.go:400] an error occurred forwarding 3000 -> 3000:Connection refused lost connection to pod
之后尝试写脚本,问题依然无法解决
while true
do
nohup kubectl --address 0.0.0.0 --namespace monitoring port-forward svc/grafana 3000 >/dev/null 2>&1 &
done
最终解决思路:
修改grafana-deployment.yaml文件,类型改成NodePort
ports:
- name: http
port: 3000
nodePort: 32000
targetPort: http
type: NodePort
(PS:笔者晚上人少的时候连接,都没断过。猜测大概率是网络原因)
lf you’re secimg thisGrasfana has failed to load its applicati
在网上搜索,个人都有个人的说话。但是经过笔者各方面排查,发现是修改grafana编译后的代码后,代码里面有错误导致的bug,所以出现此页面很可能是代码出现了bug。注意修正后记得清理浏览器缓存