{"id":15657922,"url":"https://github.com/int128/ktunnels","last_synced_at":"2026-02-21T10:02:58.236Z","repository":{"id":37825987,"uuid":"484644382","full_name":"int128/ktunnels","owner":"int128","description":"Kubernetes controller for port-forwarding from your machine to remote hosts via Envoy TCP proxy","archived":false,"fork":false,"pushed_at":"2025-04-07T00:45:21.000Z","size":1073,"stargazers_count":26,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T01:29:30.735Z","etag":null,"topics":["controller","golang","kubebuilder","kubernetes"],"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/int128.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":"2022-04-23T04:19:31.000Z","updated_at":"2025-04-07T00:45:23.000Z","dependencies_parsed_at":"2023-10-23T07:25:11.332Z","dependency_job_id":"49180d33-2965-4ab9-a95a-88203736294e","html_url":"https://github.com/int128/ktunnels","commit_stats":{"total_commits":301,"total_committers":2,"mean_commits":150.5,"dds":"0.27574750830564787","last_synced_commit":"213360c6f7c8527ab359550bb821b9f230a0ed15"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fktunnels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fktunnels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fktunnels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fktunnels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/int128","download_url":"https://codeload.github.com/int128/ktunnels/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248991526,"owners_count":21194893,"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":["controller","golang","kubebuilder","kubernetes"],"created_at":"2024-10-03T13:10:22.417Z","updated_at":"2026-02-21T10:02:58.227Z","avatar_url":"https://github.com/int128.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ktunnels [![go](https://github.com/int128/ktunnels/actions/workflows/go.yaml/badge.svg)](https://github.com/int128/ktunnels/actions/workflows/go.yaml)\n\nThis is a Kubernetes controller to set up an [Envoy Proxy](https://www.envoyproxy.io) for port-forwarding from your computer to remote hosts.\n\n## Purpose\n\nFor local development, it is nice to develop an application using a real database.\nIf a database is running in a **private network** and outside a cluster, such as Amazon RDS or Azure Database, it is **unreachable** from your computer.\n\nThis allows you to connect from your computer to a host outside a cluster.\nYou just run `kubectl port-forward` and set up your application to connect to localhost.\n\n![diagram](docs/diagram.svg)\n\nThis solution is an alternative of SSH or SOCKS bastion.\nYou no longer maintain your bastion servers.\n\n## Getting Started\n\n### For administrator\n\nDeploy the controller.\n\n```sh\nkubectl apply -f https://github.com/int128/ktunnels/releases/download/v0.9.1/ktunnels.yaml\n```\n\n### For user\n\nCreate a `Proxy` resource and `Tunnel` resource.\n\n```yaml\n# kubectl apply -f proxy.yaml\napiVersion: ktunnels.int128.github.io/v1\nkind: Proxy\nmetadata:\n  name: default\n```\n\n```yaml\n# kubectl apply -f tunnel.yaml\napiVersion: ktunnels.int128.github.io/v1\nkind: Tunnel\nmetadata:\n  name: backend-db\nspec:\n  host: backend-db.staging\n  port: 5432\n  proxy:\n    name: default\n```\n\nRun port-forward on your computer.\n\n```sh\nkubectl port-forward svc/backend-db 5432:5432\n```\n\nYou can connect to the database via `localhost:5432`.\n\n## How it works\n\nThis controller sets up a set of `Deployment` and `ConfigMap` for each proxy.\n\n```console\n% kubectl tree proxy default\nNAMESPACE  NAME                                               READY  REASON  AGE\ndefault    Proxy/default                                      -              5m9s\ndefault    ├─ConfigMap/ktunnels-proxy-default                 -              5m9s\ndefault    └─Deployment/ktunnels-proxy-default                -              5m9s\ndefault      └─ReplicaSet/ktunnels-proxy-default-5db5d68b6c   -              5m9s\ndefault        └─Pod/ktunnels-proxy-default-5db5d68b6c-wnncc  True           5m9s\n```\n\nIt also sets up a `Service` for each tunnel.\n\n```console\n% k tree tunnel main-db\nNAMESPACE  NAME                             READY  REASON  AGE\ndefault    Tunnel/main-db                   -              32m\ndefault    └─Service/main-db                -              32m\ndefault      └─EndpointSlice/main-db-cxx65  -              32m\n```\n\n## Contributions\n\nThis is an open source software licensed under Apache License 2.0.\nFeel free to open issues and pull requests for improving code and documents.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fint128%2Fktunnels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fint128%2Fktunnels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fint128%2Fktunnels/lists"}