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)
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With