To run the gRPC server,
go run greeter_server/main.go
To run the gRPC client, open the another terminal, and
go run greeter_client/main.go
If you can see this response, it is succeed.
Sorry but I just skip the details for installing minikube.
To deploy the gRPC server on the k8s cluster, follow the steps below.
- Turn on the docker desktop
minikube start
kubectl apply -f grpc-deployment.yaml
kubectl apply -f grpc-service.yaml
kubectl apply -f grpc-ingress.yaml
minikube addons enable ingress
Then you can check the pods are running with the command kubectl get pods -o wide
command.
To see the dashboard, activate the dashboard plugin with minikube addons enable dashboard
,
then type minikube dashboard
to launch the dashboard.
- Assuming that you already have
homebrew
package manager. - You can easily install
helm
with simple shell command
brew install helm
Then you can deploy the gRPC server on the k8s cluster with following simple command.
## Mac
helm install ${release name} ./grpc-demo-helm
## Ubuntu
helm install ${release name} ./grpc-demo-helm-ubuntu
## example
helm install grpc-demo-release ./grpc-demo-helm
- Check if the helm is deployed
helm ls
- Helm upgrade
helm upgrade ${new-release-name} ./grpc-demo-helm
- Helm Delete
helm uninstall ${release name}
First, you should open minikube tunnel with following command.
minikube tunnel
After 30~60 sec you apply the ingress, you can see the ingress ip address with kubectl get ingress
command.
But you can send the gRPC request with 127.0.0.1
local ip address.
-
Postman Open the postman desktop application, import the proto file in the
helloworld
directory. -
client You can also send the request with
greeter_client/main.go
client.
go run greeter_client/main.go
First, you should open minikube tunnel with following command.
minikube tunnel
Then, obtain your LoadBalancer's external ip with following command.
-> If you didn't turn on minikube tunnel, it will be shown as <pending>
.
kubectl get svc
Install gRPCurl
with following command.
go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
Then you can check the gRPC connection with following command.
grpcurl -plaintext -proto helloworld/helloworld.proto ${External IP of LB}:50051 helloworld.Greeter.SayHello
Of course you can test connection using greeter_clinet/main.go
, but you have to edit the IP address.