https://github.com/linki/k8s-proxy
standalone transparent kubectl proxy supporting exec
https://github.com/linki/k8s-proxy
Last synced: 3 months ago
JSON representation
standalone transparent kubectl proxy supporting exec
- Host: GitHub
- URL: https://github.com/linki/k8s-proxy
- Owner: linki
- License: mit
- Created: 2016-06-14T16:04:45.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-06-14T18:19:16.000Z (about 10 years ago)
- Last Synced: 2025-03-04T04:41:30.533Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# k8s-proxy
this is a proxy for a kubernetes endpoint that allows
using kubectl exec. it's supposed to be simple so people can
understand what's required to support kubectl exec through a proxy.
mainly taken from: https://github.com/openshift/origin/blob/v1.2.0/pkg/util/httpproxy/upgradeawareproxy.go
how to use me:
go run main.go \
-listen
-target
[-insecure]
e.g.
go run main.go \
-listen http://127.0.0.1:8080 \
-target https://123.123.123.123 \
-insecure
then you target your kubectl at your local endpoint, e.g.
kubectl \
--kubeconfig=/dev/null \
--server=https://127.0.0.1:8443 \
--insecure-skip-tls-verify \
--username=username \
--password=password \
exec -i --tty podname sh
gives you an interactive shell in your container through a go proxy
important to notice here is that we have to run our local server with tls because
kubectl will drop --token or --username and --password from the request
if --server is not https://...
you can use socat to forward a tls enabled endpoint to this proxy, e.g.
socat -v openssl-listen:8443,cert=server.pem,verify=0,reuseaddr,fork tcp4:localhost:8080