Coder Social home page Coder Social logo

k8s-grpc-demo's Introduction

gRPC k8s Demo

1. For gRPC server-client connection test

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

img.png

If you can see this response, it is succeed.

2. Deploying gRPC server on the k8s cluster using Minikube

Sorry but I just skip the details for installing minikube.

To deploy the gRPC server on the k8s cluster, follow the steps below.

  1. Turn on the docker desktop
  2. minikube start
  3. kubectl apply -f grpc-deployment.yaml
  4. kubectl apply -f grpc-service.yaml
  5. kubectl apply -f grpc-ingress.yaml
  6. 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.

3. Deploying with Helm

  • 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}

Test the gRPC connection (MacOS)

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.

  1. Postman img_2.png Open the postman desktop application, import the proto file in the helloworld directory.

  2. client You can also send the request with greeter_client/main.go client.

go run greeter_client/main.go

Test the gRPC connection (Ubuntu)

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

img_1.png

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.

k8s-grpc-demo's People

Contributors

alchera-mlops-sheldon avatar

Watchers

김건웅 Gunwoong Kim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.