Use Kubernetes API and increase rate limit value

10/13/2021

Im using the following code

kubeconfig = resolveKubeconfig(kubeconfig)
	if kubeconfig == "" {
		return nil, fmt.Errorf("%s: %w", msgCouldNotCreateClientConfig, ErrLocatingKubeconfig)
	}
	config, err := clientcmd.BuildConfigFromFlags("", kubeconfig)

Now I use unstruct to apply resource to the cluster (5 simple deployments)

And I saw that the apply is taking time like starting throttling,

when I change the config to use like

config.QPS = 250

it works better, and I dont face any issue.

I understand that its related for the rate limit of k8s api with the api server.

two questions:

  1. why it happen if I dont apply too much resource
  2. I increase the value, is it ok or can make some issue ?

Should I use also Burst?

I didnt find a lot of docs on the QPS and Burst ...

-- Jenny M
go
kubernetes

1 Answer

10/14/2021

By default in client-go the Burst is 10 and QPS is 5 so it should not block you if you just applied several request.

To increase the Burst and OPS no effect to your application but may create heavy load on the api-server.

-- vincent pli
Source: StackOverflow