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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sshkube-0.5.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sshkube-0.5.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file sshkube-0.5.0.tar.gz.

File metadata

  • Download URL: sshkube-0.5.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.9.6 Darwin/25.5.0

File hashes

Hashes for sshkube-0.5.0.tar.gz
Algorithm Hash digest
SHA256 c98aa71c6444841336e154a091cc90fd3e9f80b3244b2417238d0f43c733a564
MD5 cbf9a563bf14f06c009199647c236ed5
BLAKE2b-256 bb78effb9a9ed7134a6ff96d0d56d017f519786e777e37e05ed67e4c571a31eb

See more details on using hashes here.

File details

Details for the file sshkube-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: sshkube-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.9.6 Darwin/25.5.0

File hashes

Hashes for sshkube-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4096e8b6f0e814d91f2e2c4ddd93138f0e8309e017dd3ee0edb369f2af30d292
MD5 849881828d7b3a133b1f8b09c84eb25c
BLAKE2b-256 1213eb2b353874fa09f07172870d079336134f64482f5b6ff7cecf5667baf955

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page