Closed partcyborg closed 7 months ago
I tested this by creating an sshjump deployment with the same pod spec as is normally created and using it to connect.
mwilder@mwilder-1 ~/src/kubectl-plugin-ssh-jump> kubectl get deploy sshjump
NAME READY UP-TO-DATE AVAILABLE AGE
sshjump 1/1 1 1 82m
mwilder@mwilder-1 ~/src/kubectl-plugin-ssh-jump> kubectl get pods -l app=sshjump
NAME READY STATUS RESTARTS AGE
sshjump-f77c67fc6-nz422 1/1 Running 0 82m
mwilder@mwilder-1 ~/src/kubectl-plugin-ssh-jump> ./kubectl-ssh-jump 10.253.42.75 -l app=sshjump -u ubuntu -i $identity
using: port=22
Agent pid 264666
ssh-agent is already running
Using SSH jump pod sshjump-f77c67fc6-nz422...
Forwarding from 127.0.0.1:2222 -> 22
Handling connection for 2222
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Welcome to Ubuntu 20.04.5 LTS (GNU/Linux 5.15.0-1028-aws x86_64)
<snip>
ubuntu@ip-10-253-42-75:~$
Friendly ping. Any chance I could get a review @yokawasa? Support for connecting to pods in a deployment would dramatically improve our usage of kubectl ssh-jump
.
Happy to take a different approach with this too if that is what you would prefer.
@partcyborg thank you so much for the contribution! LGTM!
I came up with a different approach. Please let me have a day to test it. I'll respond shortly
@partcyborg Now ssh-jump-v0.9.0 is available! Again, thank you so much for the contribution!
# install
kubectl krew install ssh-jump
# upgrade
kubectl krew upgrade ssh-jump
# show info
kubectl krew info ssh-jump
NAME: ssh-jump
INDEX: default
URI: https://github.com/yokawasa/kubectl-plugin-ssh-jump/archive/0.9.0.zip
SHA256: a78faf87b370c619276976310aab0567a04896ec0f79703feb30d53cb7af7143
VERSION: v0.9.0
HOMEPAGE: https://github.com/yokawasa/kubectl-plugin-ssh-jump
DESCRIPTION:
A kubectl plugin to access Kubernetes nodes or remote services using a SSH jump Pod.
A jump Pod is an intermediary Pod or an SSH gateway to Kubernetes node machines or
remote services, through which a connection can be made.
CAVEATS:
\
| This plugin needs the following programs:
| * ssh(1)
| * ssh-agent(1)
|
| Please follow the documentation: https://github.com/yokawasa/kubectl-plugin-ssh-jump
/
Add support for finding a pre-existing sshjump pod by setting
--labels
to the pod's labels.This enables more advanced usage such as using a deployment instead of a standalone pod.