Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ramizpolic/kubesh

Tool to access Kubernetes nodes via SSH
https://github.com/ramizpolic/kubesh

kubectl kubernetes ssh

Last synced: about 6 hours ago
JSON representation

Tool to access Kubernetes nodes via SSH

Awesome Lists containing this project

README

        

# Kubesh

Tool to access Kubernetes nodes via SSH.
It creates a port-forward against a pod running socat, allowing SSH via localhost, and assigns a shell within the cluster.

Install
----
```
$ pip3 install -r requirements.txt
$ export PATH="$PATH:$pwd"
$ kubesh
```

Example usage
----
```bash
$ kubesh --help
usage: k8s-worker-ssh.py [-h] [--connect NODE] [--destroy] [--init] [--list]

Tool to create an SSH port-forward and shell to a k8s worker node

optional arguments:
-h, --help show this help message and exit
--connect NODE specify node to connect to by name or id
--destroy delete created resources
--init create related resources
--list list nodes in k8s cluster

$ kubesh --list
List of nodes:
1 gke-eu-cluster-default-pool-00000000-0000
2 gke-eu-cluster-default-pool-00000001-0001

$ kubesh --init
Initialized environment successfully.

$ kubesh --connect 1
Assigning pod 'tunneling-bznrfgxo'
Pod created, waiting to be ready...
Pod status is: [Pending]

Creating port-forward rules, please wait...
Forwarding from 127.0.0.1:8022 -> 8022
Forwarding from [::1]:8022 -> 8022

Initializing SSH connection...
Handling connection for 8022

user@gke-eu-cluster-default-pool-00000000-0000:~ $ echo "hello from k8s cluster"
user@gke-eu-cluster-default-pool-00000000-0000:~ $ hello from k8s cluster
user@gke-eu-cluster-default-pool-00000000-0000:~ $

$ ./kubesh --destroy
================ Roles
Deleting Role 'tunneling-bznrfgxo'
================ Role Bindings
Deleting Role Binding 'tunneling-bznrfgxo'
================ Namespace
Deleting Namespace 'tunneling'
```

License
----
MIT