Which Kubernetes client-go methods are safe for concurrent calls?

1/25/2018

The Kubernetes client-go package includes a nice example of creating a single deployment using the client-go api.

I want to create and destroy many kubernetes resources without waiting for each http request to complete.

Is it possible to use the client-go api asynchronously?

Are methods like the ones below safe for concurrent calls from multiple goroutines?

resultPod, err := clientset.CoreV1().Pods("default").Create(desiredPod)
-- Charles Holbrow
go
kubernetes

1 Answer

4/3/2018

The k8s client uses http.Client internally which is safe to call concurrently. But it is probably wise to limit the number of concurrent API calls to a reasonable upper limit (I'd start with 4; anything above that is probably not going to improve performance much).

-- simonmenke
Source: StackOverflow