运行kubectl get all
返回Throttling请求错误
我如何调试和修复这个问题?
I0223 10:28:04.717522 44883 request.go:655] Throttling request took 1.1688991s, request: GET:https://192.168.64.2:8443/apis/apps/v1?timeout=32s
I0223 10:28:14.913541 44883 request.go:655] Throttling request took 5.79656704s, request: GET:https://192.168.64.2:8443/apis/authorization.k8s.io/v1?timeout=32s
I0223 10:28:24.914386 44883 request.go:655] Throttling request took 7.394979677s, request: GET:https://192.168.64.2:8443/apis/cert-manager.io/v1alpha2?timeout=32s
I0223 10:28:35.513643 44883 request.go:655] Throttling request took 1.196992376s, request: GET:https://192.168.64.2:8443/api/v1?timeout=32s
I0223 10:28:45.516586 44883 request.go:655] Throttling request took 2.79962307s, request: GET:https://192.168.64.2:8443/apis/rbac.authorization.k8s.io/v1?timeout=32s
I0223 10:28:55.716699 44883 request.go:655] Throttling request took 4.600430975s, request: GET:https://192.168.64.2:8443/apis/node.k8s.io/v1beta1?timeout=32s
I0223 10:29:05.717707 44883 request.go:655] Throttling request took 6.196503125s, request: GET:https://192.168.64.2:8443/apis/storage.k8s.io/v1?timeout=32s
I0223 10:29:15.914744 44883 request.go:655] Throttling request took 7.99827047s, request: GET:https://192.168.64.2:8443/apis/acme.cert-manager.io/v1alpha2?timeout=32s
要诊断kubectl命令,在运行该命令时选择一个冗长级别。如果你运行kubectl -v=9
,你会得到大量的调试输出。
如果你查看这里,你可能会发现你的缓存目录在。kube中的权限是无效的。
I0511 09:28:13.431116 260204 cached_discovery.go:87] failed to write cache to /home/$USER/.kube/cache/discovery/CLUSTER_NAME/security.istio.io/v1beta1/serverresources.json due to mkdir /home/$USER/.kube/cache/discovery: permission denied
为了解决这个问题,我简单地设置了允许写入缓存数据的权限。
chmod 755 -R ~/.kube/cache
这就解决了我的问题,希望对别人有帮助。
删除sudo rm -rf ~/.kube/cache/
这对我很有效。别在这件事上花太多时间了
根据Red Hat的说法,由于RHOCP集群中安装的自定义资源定义(crd)数量的增加,到达API发现的请求受到客户端代码的限制。
我的OpenShift集群上有很多crd,我观察到了这个问题。在你的Kubernetes集群上也是这样吗?
更新kubectl版本对我有效。
原因是kubernetes发现缓存。
background, upstream status…Kubernetes发现缓存:祝福和诅咒