Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allowing to forward other hostnames than localhost (#108) #110

Merged

Conversation

luckyf
Copy link
Contributor

@luckyf luckyf commented May 5, 2023

Allowing to forward other hosts than localhost to Kubernetes.

Usage

  • ktunnel expose mynginx 8080:nginx:80 to forward all requests targeted at mynginx:8080 inside K8s to another host nginx:80.
  • If no hostname is provided, it uses localhost to preserve the current behaviour.

Testing

Tested it in combination with docker-compose to create a reproducable testing environment.

Dockerfile:

FROM dtzar/helm-kubectl:latest
COPY test/ktunnel /usr/local/bin

docker-compose.yml:

version: '3.3'
services:
  tunnel: # Creates K8s service mynginx:8080 and forwards all traffic to nginx:80
    build: .
    volumes:
      - /home/xxx/.kube/config:/root/.kube/config:ro
    command:
      - 'bash'
      - '-c'
      - 'ktunnel expose mynginx 8080:nginx:80'
  nginx: # Runs on Port 80
    image: nginx

Hi @omrikiei,
I tried my luck implementing #108. Could you have a look on this MR? Always open for change requests 😃.

Closes #108

Allowing usage of `ktunnel expose mynginx 8080:nginx:80` to forward other service `nginx` as target instead of `localhost`.
Preserves the current behaviour by using `localhost` by default.

Close omrikiei#108
@omrikiei omrikiei merged commit 9b1a7a0 into omrikiei:master May 10, 2023
@luckyf luckyf deleted the 108-allow-forwarding-other-than-localhost branch May 24, 2023 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow forwarding to more than just localhost from the client but any host visible from the client?
2 participants