func addListWatchCfgAndClient() {
cfg, err := clientcmd.BuildConfigFromFlags("", "/root/.kube/config")
if err != nil {
klog.Fatalf("Error building kubeconfig: %s", err.Error())
}
cfg.QPS = 5
cfg.Burst = 10
kubeClient, err := kubernetes.NewForConfig(cfg)
if err != nil {
klog.Fatalf("Error building kubernetes clientset: %s", err.Error())
}
...
}
当指定了qps和burst之后,令牌桶限流器和clientset是1比1关系。
当没有指定qps和burst时,默认qps和burst分别是5和10,令牌桶限流器和clientset也是1比1关系。
标签:令牌,err,burst,cfg,client,限流,Error,go From: https://www.cnblogs.com/WJQ2017/p/17986968