Skip to main content

sshkube

Configure access to a kubernetes cluster over ssh:

  • ssh public key used to authenticate users to the ssh server
  • kubeconfig is available on the ssh server
  • all kubectl commands run on the host but routed through an SSH facilitated SOCKS5 HTTPS proxy

SSH Server

  • An ssh server enables login by users with public keys fetched from github
  • The server contains a .kube/config file usable for accessing the kubernetes cluster
  • The server has tcp forwarding enabled

SSHKube Client Library

  • A python CLI
  • SSHs to the ssh server and obtains the .kube/config file
  • Runs a SOCKS5 proxy server as a daemon
  • prepares environment variables for kubectl to route requests through the SOCKS5 proxy server

Install on Cluster

# create demo cluster
k3d cluster create -a1 -p "80:80@loadbalancer" -p "443:443@loadbalancer"

DOMAIN=sshkube.localhost.u8sand.net

# install the sshkube chart
#   users specified line-by-line in githubUsers will be able to authenticate against the cluster
#   storage is used for ssh host keys persistence
#   ingress is used to forward ssl connections to the given domain to the ssh server
helm install --create-namespace -n sshkube sshkube ./charts/sshkube/ -f - << EOF
ingress:
  type: traefik
  domain: ${DOMAIN}
  certResolver: null
storage:
  class: local-path
githubUsers: |
  u8sand
EOF
# by default, users you configure will be given a namespace and exclusive access to that namespace
# cluster admins can give the user broader access if necessary, e.g.
kubectl create clusterrolebinding u8sand --clusterrole=cluster-admin --serviceaccount=u8sand:u8sand

# any user that has been granted access can use sshkube like so:

# the client library can be configured to use the public server we've deployed
# specify your github username and github identity file
sshkube install -s ${DOMAIN} -u u8sand -i ~/.ssh/id_ed25519

# we can run commands through ssh
sshkube run kubectl get secret

# or, preferred we "activate" our environment and use local kubectl
#  this will allow us to also use port-forward
eval "$(sshkube init)"
kubectl get secret

# clean up
k3d cluster delete

Metadata

Release files for sshkube 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sshkube 0.5.1
File Size Uploaded
sshkube-0.5.1.tar.gz 9.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sshkube 0.5.1
File Interpreter ABI Platform
sshkube-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 20.5 kB

Release files / sshkube-0.5.1.tar.gz

Download URL sshkube-0.5.1.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d34b127c95e2271fdd73804b8df8df26cda41834a5924034897cd6655c41d539
BLAKE2b-256 checksum
How to use checksums
c8480309f1ea2754817e7d8a8553bd7ff8bb6b9b4c469ab8ceca28ee636a105e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.9.6 Darwin/25.5.0

Release files / sshkube-0.5.1-py3-none-any.whl

Download URL sshkube-0.5.1-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1a55cad82542645539215cb0ebd7ec3fd6ea01cae75ed49d4c1e34f64346201
BLAKE2b-256 checksum
How to use checksums
ab5dc1293e2a4887c6d7598b1f1d32535e6aa32a8ffd1d8ec0703b57e8152183
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.9.6 Darwin/25.5.0

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page