kubectl-reverse-proxy

command module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

kubectl-reverse-proxy

kubectl-reverse-proxy is a kubectl plugin that starts a reverse proxy locally and routes traffic to all the pods behind a given service object.

Kubectl has a port-forward command, which basically select one random pod to connect to, and sends traffic to just that pod.

This plugin is different in that it sends the traffic to all the pods behind a given service.

Installing via krew

  • install krew using instructions here
  • run kubectl krew update
  • run kubectl krew install reverse-proxy

Usage

-> kubectl reverse-proxy simple-app

starting reverse proxy listening on localhost:9090
2024/03/07 15:26:02.392 INFO    admin   admin endpoint started  {"address": "localhost:2019", "enforce_origin": false, "origins": ["//[::1]:2019", "//127.0.0.1:2019", "//localhost:2019"]}
2024/03/07 15:26:02.392 INFO    autosaved config (load with --resume flag)      {"file": "/Users/rajatjindal/Library/Application Support/Caddy/autosave.json"}
2024/03/07 15:26:02.402 INFO    admin.api       received request        {"method": "POST", "host": "localhost:2019", "uri": "/load", "remote_ip": "127.0.0.1", "remote_port": "56843", "headers": {"Accept-Encoding":["gzip"],"Content-Length":["836"],"Content-Type":["application/json"],"User-Agent":["Go-http-client/1.1"]}}
2024/03/07 15:26:02.402 INFO    redirected default logger       {"from": "stderr", "to": "discard"}
[pod/simple-app-6c4fc84dd6-b49lb/simple-app] 2024-03-07T14:27:31.833080210Z 
[pod/simple-app-6c4fc84dd6-b49lb/simple-app] 2024-03-07T14:27:31.841354835Z Serving http://0.0.0.0:80
[pod/simple-app-6c4fc84dd6-b49lb/simple-app] 2024-03-07T14:27:31.841360710Z Available Routes:
[pod/simple-app-6c4fc84dd6-b49lb/simple-app] 2024-03-07T14:27:31.841361501Z   hello: http://0.0.0.0:80/hello
[pod/simple-app-6c4fc84dd6-b49lb/simple-app] 2024-03-07T14:27:31.841363043Z   go-hello: http://0.0.0.0:80/go-hello

with dashboard enabled

-> kubectl reverse-proxy simple-app --dashboard

starting reverse proxy listening on localhost:9090
starting metrics dashboard at http://localhost:9092
2024/03/07 15:26:02.392 INFO    admin   admin endpoint started  {"address": "localhost:2019", "enforce_origin": false, "origins": ["//[::1]:2019", "//127.0.0.1:2019", "//localhost:2019"]}
2024/03/07 15:26:02.392 INFO    autosaved config (load with --resume flag)      {"file": "/Users/rajatjindal/Library/Application Support/Caddy/autosave.json"}
2024/03/07 15:26:02.402 INFO    admin.api       received request        {"method": "POST", "host": "localhost:2019", "uri": "/load", "remote_ip": "127.0.0.1", "remote_port": "56843", "headers": {"Accept-Encoding":["gzip"],"Content-Length":["836"],"Content-Type":["application/json"],"User-Agent":["Go-http-client/1.1"]}}
2024/03/07 15:26:02.402 INFO    redirected default logger       {"from": "stderr", "to": "discard"}
[pod/simple-app-6c4fc84dd6-b49lb/simple-app] 2024-03-07T14:27:31.833080210Z 
[pod/simple-app-6c4fc84dd6-b49lb/simple-app] 2024-03-07T14:27:31.841354835Z Serving http://0.0.0.0:80
[pod/simple-app-6c4fc84dd6-b49lb/simple-app] 2024-03-07T14:27:31.841360710Z Available Routes:
[pod/simple-app-6c4fc84dd6-b49lb/simple-app] 2024-03-07T14:27:31.841361501Z   hello: http://0.0.0.0:80/hello
[pod/simple-app-6c4fc84dd6-b49lb/simple-app] 2024-03-07T14:27:31.841363043Z   go-hello: http://0.0.0.0:80/go-hello

provide namespace explicitly

-> kubectl reverse-proxy simple-app -n foo-bar

use different kubeconfig file

-> kubectl reverse-proxy simple-app --kubeconfig /path/to/different/kube/config

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL