Why kubernetes uses bost Rest API and gRPC?

11/1/2021

why k8s uses RestAPI in NodeStats/PodStats summary, but uses gRPC in CRI( RunPodSandbox/CreateContainer/StartContainer)? why doesn't k8s use gRPC in the whole project? Thank you.

-- silenzio
grpc
kubernetes

1 Answer

11/1/2021

Without knowing anything about the internals of k8s, it's reasonable to assume that it would serve generic REST endpoints for services it provides to unknown clients, but would be a gRPC client for other internal k8s services, and possibly serve gRPC to other internal k8s services.

gRPC is certainly more efficient to use for cooperating services, but it would be quite awkward for a random client not fully integrated with k8s to form a gRPC client call, so it uses a simplified REST interface for those external clients.

-- David M. Karr
Source: StackOverflow