|
| 1 | +# Reverse-proxy via rathole |
| 2 | + |
| 3 | +This folder contains shell scripts and Kubernetes resources to establish a reverse tunnel from the K8s cluster, back to your local development environment. |
| 4 | + |
| 5 | +Primarily this enables the resource-proxy feature when developing on remote K8s clusters, as Argo CD (running on vcluster-control-plane) is now able to tunnel to principal running locally. |
| 6 | + |
| 7 | +This also allows all the E2E tests to pass in this configuration. Previously, the resource proxy E2E tests were failing when running against a remote cluster. |
| 8 | + |
| 9 | + |
| 10 | +**NOTE**: The current implementation requires Service LoadBalancer support from K8s (which is available from, for example, Red Hat's 'clusterbot' service). |
| 11 | + |
| 12 | +The tunnel that is enabled is: |
| 13 | +* Argo CD 'server' workload (on vcluster-control-plane) -> managed-agent cluster Secret (on vcluster-control-plane) -> rathole Deployment (on vcluster) -> rathole Container (running on local machine) -> argocd-agent 'principal' OS process (local machine) |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +### How to enable |
| 18 | + |
| 19 | +To enable the configuration: |
| 20 | + |
| 21 | +``` |
| 22 | +# Setup environment as usual |
| 23 | +make setup-e2e2 |
| 24 | +
|
| 25 | +# Installs Rathole Deployment/Services on vcluster, update 'managed-agent' cluster Secret to point to Rathole Deployment, and start local rathole container |
| 26 | +./hack/dev-env/reverse-tunnel/setup.sh |
| 27 | +
|
| 28 | +``` |
| 29 | + |
| 30 | +To test the configuration: |
| 31 | + |
| 32 | +``` |
| 33 | +# Start E2E tests |
| 34 | +make start-e2e2 |
| 35 | +``` |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +### Configuration |
| 40 | + |
| 41 | +Running 'setup-e2e2', followed by 'reverse-tunnel/setup.sh', enables this configuration: |
| 42 | + |
| 43 | + |
| 44 | +'vcluster-control-plane' vcluster (on k8s cluster): |
| 45 | +- argocd namespace: |
| 46 | + - Argo CD workloads |
| 47 | + - Argo CD Server (no change) |
| 48 | + - Argo CD 'agent-managed' Cluster Secret |
| 49 | + - `.data.server` field points to Service, `https://rathole-container-internal:9090?agentName=agent-managed` |
| 50 | + - `.data.config` field is updated to enable insecure mode, and remove `caData` from TLS config |
| 51 | + - K8s Service |
| 52 | + - `rathole-container-internal`: internal service that directs traffic on port 9090 to `rathole` Deployment (below) |
| 53 | + |
| 54 | + - Rathole: |
| 55 | + - Deployment `rathole`: |
| 56 | + - redirects traffic from argocd (above) to local rathole container (below) |
| 57 | + - Service `rathole-container-external`: Redirect LoadBalancer to `rathole` Deployment (allows local machine to connect to cluster rathole) |
| 58 | + |
| 59 | +Running Locally: |
| 60 | +- Principal process (no change) |
| 61 | + - resource-proxy: traffic is redirect from cluster rathole Deployment to here |
| 62 | +- `rathole` container: Ultimately redirects traffic from remote argocd server (via cluster rathole) to local resource-proxy in principal process |
0 commit comments