k8s grafana的pod中执行下载grafana插件报错

pod中执行 grafana-cli plugins install grafana-clock-panel 出现以下报错:


Failed to send requesterrorGet https://grafana.com/api/plugins/repo/grafana-kubernetes-app: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) Error: ✗ Failed to send request. error: Get https://grafana.com/api/plugins/repo/grafana-kubernetes-app: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) NAME: Grafana cli plugins install - install <plugin id> <plugin version (optional)> USAGE: Grafana cli plugins install [arguments...] root@grafana-7486b9bc8c-dw52j:/usr/share/grafana# grafana-cli plugins install grafana-clock-panel Failed to send requesterrorGet https://grafana.com/api/plugins/repo/grafana-clock-panel: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) Error: ✗ Failed to send request. error: Get https://grafana.com/api/plugins/repo/grafana-clock-panel: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) NAME: Grafana cli plugins install - install <plugin id> <plugin version (optional)> USAGE: Grafana cli plugins install [arguments...]

排查思路:

ping 地址发现没有ping,安装工具也失败,使用curl发现报无法解析地址,curl其他地址也无法解析.

查看/etc/resolv.conf

root@grafana-7486b9bc8c-dw52j:/usr/share/grafana# cat /etc/resolv.conf
nameserver 192.168.0.2
search kube-system.svc.cluster.local svc.cluster.local cluster.local
options ndots:5

  

将dns地址改为 2.2.2.2 即可正常安装插件

原文地址:https://www.cnblogs.com/sunshine-long/p/15132327.html