Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@

All notable changes to the "kubectl-plugin-ssh-jump" extension will be documented in this file.

## 0.3.2

- Changed a validation for destination name to support valid characters of hostname for SSH destination node that can start from ASCII letters 'a' through 'z' (in a case-insensitive manner), the digits '0' through '9', or the hyphen ('-'). Ref [RFC952](https://tools.ietf.org/html/rfc952) for valid characters of hostname.
- Add Internal-IP info, not only hostname for node info in running get-node-list

## 0.3.1

- fixed typo: missing char ( [PR#3](https://github.com/yokawasa/kubectl-plugin-ssh-jump/pull/3), thanks to @iuryfukuda )

## 0.3.0

- Added Args param to exec in ssh session ( [PR#2](https://github.com/yokawasa/kubectl-plugin-ssh-jump/pull/2), thanks to @iuryfukuda )

## 0.2.0

- Added -P|--port options for specifing SSH port that target node is listening (default 22)
- Added -o "StrictHostKeyChecking=no" for ssh login options
- Changed the way to SSH login via SSH Jump Pod from using "-J" to using "ProxyCommand"
Expand Down
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This plugin needs the following programs:
## Installation

### Install through krew
This is a way to install kubectl-ssh-jump through [krew](https://github.com/GoogleContainerTools/krew). After installing krew by following [this](https://github.com/GoogleContainerTools/krew#installation), you can install kubectl-ssh-jump like this:
This is a way to install kubectl-ssh-jump through [krew](https://krew.sigs.k8s.io/). After installing krew by following [this](https://krew.sigs.k8s.io/docs/user-guide/setup/install/), you can install kubectl-ssh-jump like this:

```sh
$ kubectl krew install ssh-jump
Expand Down Expand Up @@ -89,7 +89,10 @@ Usage:
kubectl ssh-jump <dest_node> [options]

Options:
<dest_node> Destination node IP
<dest_node> Destination node name or IP address
dest_node must start from the following letters:
ASCII letters 'a' through 'z' or 'A' through 'Z',
the digits '0' through '9', or hyphen ('-'
-u, --user <sshuser> SSH User name
-i, --identity <identity_file> Identity key file
-p, --pubkey <pub_key_file> Public key file
Expand Down Expand Up @@ -134,7 +137,10 @@ Usage:
kubectl ssh-jump <dest_node> [options]

Options:
<dest_node> Destination node IP
<dest_node> Destination node name or IP address
dest_node must start from the following letters:
ASCII letters 'a' through 'z' or 'A' through 'Z',
the digits '0' through '9', or hyphen ('-')
-u, --user <sshuser> SSH User name
-i, --identity <identity_file> Identity key file
-p, --pubkey <pub_key_file> Public key file
Expand All @@ -154,10 +160,11 @@ Example:
....

List of destination node...
Hostname
aks-nodepool1-18558189-0
aks-nodepool1-18558189-1
aks-nodepool1-18558189-2
Hostname Internal-IP
aks-nodepool1-18558189-0 10.240.0.4
aks-nodepool1-18558189-1 10.240.0.5
aks-nodepool1-18558189-2 10.240.0.6

```

Then, SSH into a node `aks-nodepool1-18558189-0` with options like:
Expand All @@ -168,6 +175,7 @@ Then, SSH into a node `aks-nodepool1-18558189-0` with options like:
$ kubectl ssh-jump aks-nodepool1-18558189-0 \
-u azureuser -i ~/.ssh/id_rsa_k8s -p ~/.ssh/id_rsa_k8s.pub
```
> [NOTE] you can try SSH into a node using node IP address (`Internal-IP`) instead of `Hostname`

As explained in usage secion, `username`, `identity`, `pubkey` options are cached, therefore you can omit these options afterward.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.0
0.3.2
11 changes: 7 additions & 4 deletions kubectl-ssh-jump
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ help(){
options(){
cat <<"EOF"
Options:
<dest_node> Destination node IP
<dest_node> Destination node name or IP address
dest_node must start from the following letters:
ASCII letters 'a' through 'z' or 'A' through 'Z',
the digits '0' through '9', or hyphen ('-')
-u, --user <sshuser> SSH User name
-i, --identity <identity_file> Identity key file
-p, --pubkey <pub_key_file> Public key file
Expand Down Expand Up @@ -65,7 +68,7 @@ EOF

get_node_list(){
echo "List of destination node..."
kubectl get no -o custom-columns=Hostname:.metadata.name
kubectl get no -o custom-columns=Hostname:.metadata.name,Internal-IP:'{.status.addresses[?(@.type=="InternalIP")].address}'
echo ""
}

Expand Down Expand Up @@ -138,7 +141,7 @@ run_ssh_node(){
kubectl port-forward sshjump 2222:22 2>/dev/null &
pid_port_forward=$!
# Inject public SSH key to sshjump
cat ${pubkey} | kubectl exec -i sshjump -- /bin/bash -c "cat >> /root/.ssh/authorized_keys"
cat ${pubkey} | kubectl exec -i sshjump -- /bin/bash -c "cat > /root/.ssh/authorized_keys"

# Using the SSH Server as a jumphost (via port-forward proxy), ssh into the desired Node
ssh -i ${identity} -p ${port} ${sshuser}@${destnode} \
Expand Down Expand Up @@ -189,7 +192,7 @@ plugin_main() {
sshargs="$2"
nSkip=2
;;
[a-z]*)
[0-9a-zA-Z-]*)
destnode=$1
;;
*)
Expand Down