All Projects β†’ kayrus β†’ Kuttle

kayrus / Kuttle

Licence: gpl-2.0
Kubernetes wrapper for sshuttle

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Kuttle

Geodesic
πŸš€ Geodesic is a DevOps Linux Distro. We use it as a cloud automation shell. It's the fastest way to get up and running with a rock solid Open Source toolchain. β˜… this repo! https://slack.cloudposse.com/
Stars: ✭ 629 (+631.4%)
Mutual labels:  kubectl
Helm Docker
☸️ helm, gcloud, kubectl, jq
Stars: ✭ 41 (-52.33%)
Mutual labels:  kubectl
Kubectl Trace
Schedule bpftrace programs on your kubernetes cluster using the kubectl
Stars: ✭ 1,194 (+1288.37%)
Mutual labels:  kubectl
Kubie
A more powerful alternative to kubectx and kubens
Stars: ✭ 647 (+652.33%)
Mutual labels:  kubectl
K8s Utils
Kubernetes Utility / Helper Scripts
Stars: ✭ 33 (-61.63%)
Mutual labels:  kubectl
Docker Kubectl
Containerized Kubernetes kubectl
Stars: ✭ 52 (-39.53%)
Mutual labels:  kubectl
Kubelive
kubectl tool reinvented to be more reactive and interactive πŸ”₯
Stars: ✭ 497 (+477.91%)
Mutual labels:  kubectl
Kubeplay
kubeplay – a new way to interact with Kubernetes API from your terminal
Stars: ✭ 83 (-3.49%)
Mutual labels:  kubectl
Kube Aliases
Kubernetes Aliases and Bash Functions
Stars: ✭ 40 (-53.49%)
Mutual labels:  kubectl
Kubectl Capture
A kubectl plugin which triggers a Sysdig capture
Stars: ✭ 66 (-23.26%)
Mutual labels:  kubectl
Rakkess
Review Access - kubectl plugin to show an access matrix for k8s server resources
Stars: ✭ 751 (+773.26%)
Mutual labels:  kubectl
Colossus
Colossus β€”Β An example microservice architecture for Kubernetes using Bazel, Go, Java, Docker, Kubernetes, Minikube, Gazelle, gRPC, Prometheus, Grafana, and more
Stars: ✭ 917 (+966.28%)
Mutual labels:  kubectl
Kubernetes Cheatsheet
This is Kubernetes Cheatsheet based on Kubernetes API 1.19 version.
Stars: ✭ 53 (-38.37%)
Mutual labels:  kubectl
Gcr.io mirror
all of the gcr.io docker image mirror
Stars: ✭ 650 (+655.81%)
Mutual labels:  kubectl
Kubectl Cssh
A kubectl plugin to ssh into Kubernetes nodes within separate tmux panes
Stars: ✭ 76 (-11.63%)
Mutual labels:  kubectl
Kubelogin
kubectl plugin for Kubernetes OpenID Connect authentication (kubectl oidc-login)
Stars: ✭ 495 (+475.58%)
Mutual labels:  kubectl
Bitnami Docker Kubectl
Bitnami Docker Image for Kubectl
Stars: ✭ 50 (-41.86%)
Mutual labels:  kubectl
Kubectl Build
Build dockerfiles directly in your Kubernetes cluster.
Stars: ✭ 84 (-2.33%)
Mutual labels:  kubectl
Terraform Eks
Terraform for AWS EKS
Stars: ✭ 82 (-4.65%)
Mutual labels:  kubectl
Kauthproxy
Local authentication proxy for Kubernetes Dashboard (kubectl auth-proxy)
Stars: ✭ 54 (-37.21%)
Mutual labels:  kubectl

kuttle: kubectl wrapper for sshuttle without SSH

Kuttle allows you to easily get an access into your Kubernetes network environment. SSH access is not required, since kubectl is used instead of ssh.

In comparison with Telepresence, kuttle only proxies Kubernetes network onto your local laptop.

Installation

Install sshuttle following official documentation or use your distro's package manager:

  • MacOS: brew install sshuttle
  • Debian/Ubuntu: apt-get install sshuttle
  • Fedora/RedHat/CentOS: yum install sshuttle

Download kuttle:

wget https://github.com/kayrus/kuttle/raw/master/kuttle
chmod +x kuttle

Additionally you can place kuttle into $PATH

How does it work?

Under the hood sshuttle spawns a remote python oneliner that evaluates a server code, received via stdin, which proxies the traffic. To get a connection to the remote server sshuttle usually uses ssh. kuttle allows sshuttle to use kubectl without any ssh dependencies.

Regular sshuttle process tree

$ pstree -pal `pidof -x sshuttle`
sshuttle,1489 /usr/bin/sshuttle -r remote.example.com 10.254.0.0/16
  β”œβ”€ssh,1492 remote.example.com -- exec /bin/sh -c 'P=python3.5; $P -V 2>/dev/null || P=python; exec "$P" -c '"'"'import sys, os; verbosity=0; sys.stdin = os.fdopen(0, "rb"); exec(compile(sys.stdin.read(978), "assembler.py", "exec"))'"'"''
  └─sudo,1490 -p [local sudo] Password:  PYTHONPATH=/usr/lib/python3/dist-packages -- /usr/bin/python3 /usr/bin/sshuttle --method auto --firewall
      └─python3,1491 /usr/bin/sshuttle --method auto --firewall

sshuttle + kuttle process tree

$ pstree -pal `pidof -x sshuttle`
sshuttle,1538 /usr/bin/sshuttle -r kuttle -e kuttle 10.254.0.0/16
  β”œβ”€kubectl,1541 exec -i kuttle -- /bin/sh -c exec /bin/sh -c 'P=python3.5; $P -V 2>/dev/null || P=python; exec "$P" -c '"'"'import sys, os; verbosity=0; sys.stdin = os.fdopen(0, "rb"); exec(compile(sys.stdin.read(978), "assembler.py", "exec"))'"'"''
  β”‚   β”œβ”€{kubectl},1544
  β”‚   β”œβ”€{kubectl},1547
  β”‚   β”œβ”€{kubectl},1551
  β”‚   β”œβ”€{kubectl},1552
  β”‚   β”œβ”€{kubectl},1553
  β”‚   β”œβ”€{kubectl},1556
  β”‚   β”œβ”€{kubectl},1557
  β”‚   └─{kubectl},1558
  └─sudo,1539 -p [local sudo] Password:  PYTHONPATH=/usr/lib/python3/dist-packages -- /usr/bin/python3 /usr/bin/sshuttle --method auto --firewall
      └─python3,1540 /usr/bin/sshuttle --method auto --firewall

Target Kubernetes pod requirements

Since sshuttle uses python interpreter, python should be installed inside target pod's container.

Prior to version 0.78.2, sshuttle used netstat to list routes. If your sshuttle version is older than 0.78.2, you have to ensure that netstat CLI is also installed inside pod's container.

Simple alpine container with a minimal python is enough for kuttle. You can use the kubectl command below in order to spawn ready-to-use pod as a VPN server:

kubectl run kuttle --image=alpine:latest --restart=Never -- sh -c 'apk add python --update && exec tail -f /dev/null'
sshuttle -r kuttle -e kuttle 0.0.0.0/0

Examples

Route local requests to the 10.254.0.0/16 subnet via pod-with-python pod in your Kubernetes cluster:

sshuttle -r '--context my-context --namespace default pod-with-python' -e /path/to/kuttle 10.254.0.0/16

Use your Kubernetes pod as a VPN server with DNS requests being resolved by pod:

sshuttle --dns -r '--context my-context --namespace default pod-with-python' -e /path/to/kuttle 0.0.0.0/0

If you already have set kubectl defaults and placed kuttle in $PATH, just specify the pod name:

sshuttle --dns -r pod-with-python -e kuttle 0.0.0.0/0

Credits

Thanks to sshuttle authors and @databus23 for getting me inspired.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].