I have a kubernetes pod, which consists of a container. Within the container, there is a script that I want to run if the container receives a RPC.
I am not familiar with RPC, so this is what I think about the workflow:
1. create a gRPC client (I am thinking of gin
, but any to recommend?)
2. set up the container as server with port xxxx
exposed (how?)
3. gRPC client sends a request to the container at port xxxx
to trigger the script
Is my understanding about the workflow correct?
If my understanding is correct, a brief code snippet or pseudocode in achieving the workflow the will be great!
gRPC is a high performance, open-source universal RPC framework, based on the TCP communication. It is possible to send RPC requests to Docker containers running under control of Kubernetes. It is strongly not recommended to do it this way, because the containers have no static IP address assigned and application probably will do not know the actual state of the container. Please consider thinking of Kubernetes services as the endpoints of your RPC requests. Kubernetes services expose static IP mapping and High Availability to make sure that established connections execute a remote calls.
This article may help understand how to deploy RPC application with Kubernetes.