{"id":19645395,"url":"https://github.com/pedro-r-marques/k8s-service-proxy","last_synced_at":"2025-04-28T14:32:44.706Z","repository":{"id":79996240,"uuid":"68631927","full_name":"pedro-r-marques/k8s-service-proxy","owner":"pedro-r-marques","description":"HTTP Proxy for kubernetes services","archived":false,"fork":false,"pushed_at":"2023-03-07T00:31:15.000Z","size":92,"stargazers_count":18,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T09:11:21.259Z","etag":null,"topics":["kubernetes","oauth2-proxy"],"latest_commit_sha":null,"homepage":null,"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/pedro-r-marques.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-19T18:01:28.000Z","updated_at":"2023-03-17T14:38:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"6b4ed925-b7f8-4cbd-b298-4df8331d2acf","html_url":"https://github.com/pedro-r-marques/k8s-service-proxy","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/pedro-r-marques%2Fk8s-service-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedro-r-marques%2Fk8s-service-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedro-r-marques%2Fk8s-service-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedro-r-marques%2Fk8s-service-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pedro-r-marques","download_url":"https://codeload.github.com/pedro-r-marques/k8s-service-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251330493,"owners_count":21572293,"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":["kubernetes","oauth2-proxy"],"created_at":"2024-11-11T14:33:44.491Z","updated_at":"2025-04-28T14:32:39.665Z","avatar_url":"https://github.com/pedro-r-marques.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# k8s-service-proxy\n\n[![Build Status](https://travis-ci.org/pedro-r-marques/k8s-service-proxy.svg?branch=master)](https://travis-ci.org/pedro-r-marques/k8s-service-proxy)\n[![Go Report Card](https://goreportcard.com/badge/github.com/pedro-r-marques/k8s-service-proxy)](https://goreportcard.com/report/github.com/pedro-r-marques/k8s-service-proxy)\n\nHTTP Proxy for kubernetes services\n\nThis process implements a simple HTTP proxy based on the golang [httputil] [ReverseProxy]\nclass. It auto-discovers the HTTP backends based on Annotations of the Kubernetes Services objects.\nIt can be used in conjunction with an oauth2 proxy (e.g. [oauth2]) to provide acccess controlled\naccess to services.\n\nFor instance, it is common to run internal/debug HTTP ports that need to be access controlled; in\nin order to provide access to such information, it is useful to be able to expose a single external\nservice that performs authentication and demuxes requests to the backends.\n\nThe service proxy expects services to define annotations such as:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example\n  annotations:\n    k8s-svc-proxy.local/path: /example-path/\n```\n\nThis would case the proxy to direct all traffic for `\"/example-path/\"` to the \"example\" service. The\nreceiving pods are expected to process requests that include `\"/example-path/\"`\n\nFor services that expose a single port, the proxy will automatically use the port number defined in\nthe service configuration. Services that expose multiple ports are expected to use the\nannotation `k8s-svc-proxy.local/port` to specify the port number for the redirected traffic.\n\nURLs can be remapped by specifying the annotation `k8s-svc-proxy.local/map`. This causes the `path` prefix\nof a request to be replaced with the string specified by `map`. Note that the HTTP response is not\nprocessed in anyway. Any absolute `href` URLs will be incorrect.\n\nFor diagnostic purposes, the proxy serves a status page. The annotation `k8s-svc-proxy.local/description`\ncan be used to add human readable content to this page.\n\n## Endpoints\n\nServices are often implemented by multiple Pods. These pods often have http listeners that provide information specific\nto the Pod (e.g. /debug). The annotation `\"k8s-svc-proxy.local/endpoint-port\"` automatically exposes the specified\nport in all the endpoints of the service as `\"/endpoint/\u003cnamespace\u003e/\u003csvc-name\u003e/\u003cid\u003e\"` where id is an index automatically assigned\nby the alphabetic order of pod names.\n\n## Example configuration\n\n- k8s deployment:\n\n```yaml\napiVersion: extensions/v1beta1\nkind: Deployment\nmetadata:\n  name: oauth2-proxy\nspec:\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: oauth2-proxy\n    spec:\n      containers:\n        - name: oauth2-proxy\n          image: oauth2_proxy\n          env:\n            - name: OAUTH2_PROXY_CLIENT_ID\n              valueFrom:\n                secretKeyRef:\n                  name: oauth2-proxy\n                  key: client-id\n            - name: OAUTH2_PROXY_CLIENT_SECRET\n              valueFrom:\n                secretKeyRef:\n                  name: oauth2-proxy\n                  key: client-secret\n          ports:\n            - containerPort: 4180\n              name: oauth2-proxy\n        - name: k8s-svc-proxy\n          image: k8s-svc-proxy\n          ports:\n            - containerPort: 8080\n\n```\n\n- etc/oauth2_proxy.cfg\n\n```text\nhttp_address = \"0.0.0.0:4180\"\n\nemail_domains = [\n    \"example.com\"\n]\n\nupstreams = [\n    \"http://localhost:8080/\",\n]\n```\n\n[oauth2]: https://github.com/bitly/oauth2_proxy\n[httputil]: https://golang.org/pkg/net/http/httputil/\n[ReverseProxy]: https://golang.org/pkg/net/http/httputil/#ReverseProxy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedro-r-marques%2Fk8s-service-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpedro-r-marques%2Fk8s-service-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedro-r-marques%2Fk8s-service-proxy/lists"}