gRPC support in kuma
kuma control plane
Kuma is a control plane for service mesh which runs on both k8’s
and virtual machines. kuma uses envoy
as it’s dataplane proxy.
Initially, kuma comes with http
and tcp
protocol support and it lacks support for grpc
which is used for large-scale microservice communication.
gRPC support
So, I raised a Pull Request to kuma adding gRPC support and it was merged :) Pull Request
Let see how we can leverage gPRC support in kuma.
First, install kuma command line utility from (https://kuma.io/install/latest/) or through homebrew
brew install kumactl
Then clone this repository (https://github.com/tharun208/kuma-grpc-example) which contains a basic gRPC client/server with kubernetes resource files.
Install kuma-cp
to your k8’s through kumactl install control-plane | kubectl apply -f -
Now, apply the kubernetes resources from the repo.
kubectl apply -f deployment/api-service.yaml
kubectl apply -f deployment/summation-service.yaml
Now, If we see the number of pods deployed it will be 1. Now, it time to make kuma to inject it’s side-car’s.It is simple as
kubectl annotate namespace grpc-demo kuma.io/sidecar-injection=enabled --overwrite
Now, delete the existing pods to make kuma to inject side-cars.
kubectl delete pods --all -n grpc-demo
Now, the number of pods running will be 2 for each deployment.
Hit the api service and you will get the response
curl http://192.168.64.13:30080/add/1/2
"Summation is 3"
See the stats of your add-service dataplane. The gRPC filter of envoy counts the number of successful and failed calls, optionally grouping them by the gRPC method name and the stats may be prefixed with <grpc service>.<grpc method>
.