{"id":37144391,"url":"https://github.com/bakins/kubernetes-envoy-example","last_synced_at":"2026-01-14T16:57:17.332Z","repository":{"id":57548120,"uuid":"101758918","full_name":"bakins/kubernetes-envoy-example","owner":"bakins","description":"Teaching myself about Envoy on Kubernetes","archived":true,"fork":false,"pushed_at":"2018-01-05T11:25:36.000Z","size":23451,"stargazers_count":122,"open_issues_count":3,"forks_count":23,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-06T10:45:11.518Z","etag":null,"topics":["envoy","grpc","jaeger","kubernetes","minikube","prometheus","service-discovery"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bakins.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-29T12:31:19.000Z","updated_at":"2024-02-24T23:31:12.000Z","dependencies_parsed_at":"2022-09-13T08:00:37.797Z","dependency_job_id":null,"html_url":"https://github.com/bakins/kubernetes-envoy-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bakins/kubernetes-envoy-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Fkubernetes-envoy-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Fkubernetes-envoy-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Fkubernetes-envoy-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Fkubernetes-envoy-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bakins","download_url":"https://codeload.github.com/bakins/kubernetes-envoy-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakins%2Fkubernetes-envoy-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28427164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["envoy","grpc","jaeger","kubernetes","minikube","prometheus","service-discovery"],"created_at":"2026-01-14T16:57:16.555Z","updated_at":"2026-01-14T16:57:17.321Z","avatar_url":"https://github.com/bakins.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kubernetes Envoy Example\n\nA sample application using [Envoy](https://lyft.github.io/envoy/) running in Kubernetes.\n\n## Motivation\n\nI wanted to learn more about Envoy, so I decided to do it \"the hard way.\" I wrote\nthe contrived example application and pieced together the Envoy configurations\nfrom the documentation and examples.\n\n## Sample Application Summary\n\nThe sample application is fairly straight forward.  It has four components:\n\n* _frontend_ - HTTP service written in Go. It accepts the request from the client\nand makes calls to the other services.\n* _user_ - [gRPC](https://grpc.io/) service written in Go. Manages user information.\n* _order_ - [gRPC](https://grpc.io/) service written in Go. Tracks orders. Makes calls\nto the _item_ service for details about each ordered item.\n* _item_ - [gRPC](https://grpc.io/) service written in PHP (more on this below).\nInventory of items.\n\nThe basic flow of data through the service is\n\n![Logical Architecture](./logical.png)\n\nServices do not communicate directly with one another. All communication is via\nEnvoy.  An Envoy instance - named _ingress_ - acts as the entrypoint into the cluster.\nThis is similar to the \"[Service to service plus front proxy](https://lyft.github.io/envoy/docs/intro/deployment_types/front_proxy.html)\" example.\n\nThe network flow of data is\n\n![Service Communication](./communication.png)\n\n## Services Detail\n\nEach instance of each service runs in a [Kubernetes pod](https://kubernetes.io/docs/concepts/workloads/pods/pod/). Each pod has multiple\ncontainers:\n\n* the application itself\n* Envoy proxy\n* [statsd_exporter](https://github.com/prometheus/statsd_exporter) - Envoy emits metrics using [statsd](https://lyft.github.io/envoy/docs/intro/arch_overview/statistics.html?highlight=statsd). `statsd_exporter` is a statsd server that exposes these metrics\nfo consumption by [Prometheus](https://prometheus.io/). \n\nThe ingress contains only Envoy and statsd exporter.\n\nThe Envoy container in each pod listens on one port (8080)\nfor incoming requests and routes these to the local application running within the pod.\nEnvoy listens on a different port (7070) for outbound requests.  Applications make\nrequests to http://127.0.0.1:7070 for other services rather than connecting direct.\nSee [order.json](./deploy/envoy/order.json) for example.\n\nAll the applications expose metrics for Prometheus.\n\nThe frontend is the user facing service. It accepts HTTP/1.1 requests on the front and\nmakes gRPC requests to the other services.\n\nThe item service uses [grpc-fastcgi-proxy](https://github.com/bakins/grpc-fastcgi-proxy) to expose a simple PHP applciation.  This service could represent a legacy system\nwritten in PHP that we wish to expose.\n\nThe other services - user and order - are simple gRPC services written in Go.\n\n## Tracing\n\n[Jaeger](https://github.com/uber/jaeger) is used for tracing. Envoy is [configured](https://lyft.github.io/envoy/docs/intro/arch_overview/tracing.html)\nto send tracing information to the [Zipkin compatible endpoint](http://jaeger.readthedocs.io/en/latest/getting_started/#migrating-from-zipkin) of Jaeger.\n\nThe applications do not send any data to Jaeger. They only ensure the tracing headers\nare [propogated](https://lyft.github.io/envoy/docs/install/sandboxes/zipkin_tracing.html).\n\n## Service Discovery\n\nEnvoy handles all service discovery - the applications just contact Envoy on lcoal host.\n[Kubernetes headless services](https://kubernetes.io/docs/concepts/services-networking/service/#headless-services) are used. This means a DNS request for the service will return a record for each running Pod.\nThis is a simple service discovery mechanism that does not require additional helper services.\n\n\n## Usage\n\nThis example is designed to be ran on [minikube](https://github.com/kubernetes/minikube). \nA working [Go](https://golang.org/doc/install) environment is required.\nOnce minikube is installed and running, one should clone this repository into \nthe GOPATH:\n\n```shell\nmkdir -p $HOME/go/src/github.com/bakins\ngit clone https://github.com/bakins/kubernetes-envoy-example.git\ncd kubernetes-envoy-example\n```\n\nNow to build and deploy the example applications:\n\n* `./script/build` will build the applications and push Docker images into\nthe minikube Docker environment.\n* `./script/deploy` will deploy the Kubernetes manifests.\n\nAfter a few seconds, you should be able to access the application by running\n`minikube service ingress` - you should see a simple json body.\n\nTo access jaeger, run `minikube service jaeger-query`. You may need to reload in the\nbrowser a few times.\n\nPrometheus is available via `minikube service prometheus`.  You should be able to\nrun adhoc [queries](https://prometheus.io/docs/querying/basics/) for metrics.\n\nTODO: grafana dashboards\n\n## Prometheus Queries\n\n`histogram_quantile(0.95, sum(rate(envoy_upstream_rq_time_bucket{cluster!=\"local_service\"}[5m])) by (le,app, cluster))`\n\n`sum(rate(envoy_upstream_rq_time_count{cluster!=\"local_service\"}[5m])) by (app, cluster)`\n\n`sum(envoy_health_check_healthy) by (app,cluster)`\n\n`sum(envoy_upstream_cx_total) by (app,cluster)`\n\n## LICENSE\n\nSee [LICENSE](./LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakins%2Fkubernetes-envoy-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbakins%2Fkubernetes-envoy-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakins%2Fkubernetes-envoy-example/lists"}