{"id":22983259,"url":"https://github.com/mikejoh/grpc-echo-service","last_synced_at":"2025-04-02T10:22:29.253Z","repository":{"id":133966016,"uuid":"362230917","full_name":"mikejoh/grpc-echo-service","owner":"mikejoh","description":"A super simple gRPC example inspired by the official helloworld example from grpc.io","archived":false,"fork":false,"pushed_at":"2021-06-04T07:17:15.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-13T04:02:25.293Z","etag":null,"topics":["grpc","grpc-go","helm","kind","kubernetes","metallb"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikejoh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-27T19:40:48.000Z","updated_at":"2021-06-04T07:43:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"d12ca553-7d39-43af-9e42-c2d04c66f328","html_url":"https://github.com/mikejoh/grpc-echo-service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikejoh%2Fgrpc-echo-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikejoh%2Fgrpc-echo-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikejoh%2Fgrpc-echo-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikejoh%2Fgrpc-echo-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikejoh","download_url":"https://codeload.github.com/mikejoh/grpc-echo-service/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246794434,"owners_count":20834992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grpc","grpc-go","helm","kind","kubernetes","metallb"],"created_at":"2024-12-15T02:37:01.605Z","updated_at":"2025-04-02T10:22:29.235Z","avatar_url":"https://github.com/mikejoh.png","language":"Go","readme":"# gRPC echo service\n\n_Heavily inspired by the official grpc [`helloworld`](https://grpc.io/docs/languages/go/quickstart/) example but with a fully working Kubernetes deployment example._\n\n_Will only work on your machine._\n\nThe echo-service works as follows: The server will answer `pong` on any `ping` request sent using the gRPC client. The `pong` response and `ping` message are hardcoded in the server and client.\n\n## Prerequisites\n* Docker\n* [`kind`](https://kind.sigs.k8s.io/docs/user/quick-start/#installation)\n* `protoc` and Go plugins for the protocol compiler\n* Go\n## How to\n1. See the prerequisites [here](https://grpc.io/docs/languages/go/quickstart/#prerequisites) to install `protoc` and the Go plugins needed.\n2. In the root of this repository run:\n```\nmake gen-proto\n```\n3. Start the `kind` cluster:\n```\nkind create cluster --name k8s-1.19.7 --config kind/k8s-1.19.7.yaml\n```\n4. Install `metallb` to be able to create a `Service` of type `LoadBalancer` in Kubernetes:\n```\nkubectl apply -f https://raw.githubusercontent.com/metallb/metallb/master/manifests/namespace.yaml\nkubectl create secret generic -n metallb-system memberlist --from-literal=secretkey=\"$(openssl rand -base64 128)\" \nkubectl apply -f https://raw.githubusercontent.com/metallb/metallb/master/manifests/metallb.yaml\n```\n5. Identify the CIDR network used by Docker:\n```\ndocker network inspect -f '{{.IPAM.Config}}' kind\n```\n6. Create and apply a `ConfigMap` using a subset of the addresses in the CIDR from the output above, you should replace the IP addresses `addresses` field below:\n```\ncat \u003c\u003cEOF | kubectl apply -f -\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  namespace: metallb-system\n  name: config\ndata:\n  config: |\n    address-pools:\n    - name: default\n      protocol: layer2\n      addresses:\n      - 172.18.255.200-172.18.255.250\nEOF\n```\n7. Build the grpc-echo-service Docker image:\n```\ndocker build . -t grpc-echo-service:v0.1.0\n```\n8. Push the built grpc-echo-service Docker image to a registry.\n9. Change the image in `manifests/deployment.yaml` pointing to the one you've just pushed.\n10. Apply the `deployment.yaml` and `service.yaml` files.\n```\nkubectl apply -f manifests/deployment.yaml\nkubectl apply -f manifests/service.yaml\n```\n11. Take a note of the Load Balancer IP the `Service` have received from MetalLB:\n```\nkubectl get svc grpc-echo-service -o=jsonpath='{.status.loadBalancer.ingress[0].ip}'\n```\n12. Add the Load Balancer IP to the `cert/echo_client-ext.cnf` and `cert/echo_server-ext.cnf` files.\n13. Re-generate the certificates:\n```\nmake gen-cert\n```\n14. Re-build and re-push the Docker image.\n15. Restart the Deployment of grpc-echo-service server component:\n```\nkubectl deployment rollout restart grpc-echo-service\n```\n16. Run the gRPC client:\n```\ngo run echo_client/*.go -addr \"172.18.255.200:8443\" -cert cert/client-cert.pem -key cert/client-key.pem\n```\nyou should see an output similar to this one:\n```\n2021/05/02 22:40:35 Starting gRPC echo service client..\n2021/05/02 22:40:35 Echoes service replied: pong\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikejoh%2Fgrpc-echo-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikejoh%2Fgrpc-echo-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikejoh%2Fgrpc-echo-service/lists"}