Skip to content

Commit b2d8c7c

Browse files
committed
Merge branch 'master' of github.com:yokawasa/kubectl-plugin-ssh-jump
2 parents 88f32c7 + 25da98d commit b2d8c7c

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@
22

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

5+
## 0.3.2
6+
7+
- 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.
8+
- Add Internal-IP info, not only hostname for node info in running get-node-list
9+
510
## 0.3.1
11+
612
- fixed typo: missing char ( [PR#3](https://github.com/yokawasa/kubectl-plugin-ssh-jump/pull/3), thanks to @iuryfukuda )
713

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

1118
## 0.2.0
19+
1220
- Added -P|--port options for specifing SSH port that target node is listening (default 22)
1321
- Added -o "StrictHostKeyChecking=no" for ssh login options
1422
- Changed the way to SSH login via SSH Jump Pod from using "-J" to using "ProxyCommand"

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ Usage:
9191
kubectl ssh-jump <dest_node> [options]
9292
9393
Options:
94-
<dest_node> Destination node IP
94+
<dest_node> Destination node name or IP address
95+
dest_node must start from the following letters:
96+
ASCII letters 'a' through 'z' or 'A' through 'Z',
97+
the digits '0' through '9', or hyphen ('-'
9598
-u, --user <sshuser> SSH User name
9699
-i, --identity <identity_file> Identity key file
97100
-p, --pubkey <pub_key_file> Public key file
@@ -136,7 +139,10 @@ Usage:
136139
kubectl ssh-jump <dest_node> [options]
137140

138141
Options:
139-
<dest_node> Destination node IP
142+
<dest_node> Destination node name or IP address
143+
dest_node must start from the following letters:
144+
ASCII letters 'a' through 'z' or 'A' through 'Z',
145+
the digits '0' through '9', or hyphen ('-')
140146
-u, --user <sshuser> SSH User name
141147
-i, --identity <identity_file> Identity key file
142148
-p, --pubkey <pub_key_file> Public key file
@@ -156,10 +162,11 @@ Example:
156162
....
157163

158164
List of destination node...
159-
Hostname
160-
aks-nodepool1-18558189-0
161-
aks-nodepool1-18558189-1
162-
aks-nodepool1-18558189-2
165+
Hostname Internal-IP
166+
aks-nodepool1-18558189-0 10.240.0.4
167+
aks-nodepool1-18558189-1 10.240.0.5
168+
aks-nodepool1-18558189-2 10.240.0.6
169+
163170
```
164171
165172
Then, SSH into a node `aks-nodepool1-18558189-0` with options like:
@@ -170,6 +177,7 @@ Then, SSH into a node `aks-nodepool1-18558189-0` with options like:
170177
$ kubectl ssh-jump aks-nodepool1-18558189-0 \
171178
-u azureuser -i ~/.ssh/id_rsa_k8s -p ~/.ssh/id_rsa_k8s.pub
172179
```
180+
> [NOTE] you can try SSH into a node using node IP address (`Internal-IP`) instead of `Hostname`
173181
174182
As explained in usage secion, `username`, `identity`, `pubkey` options are cached, therefore you can omit these options afterward.
175183

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.1
1+
0.3.2

kubectl-ssh-jump

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ help(){
2121
options(){
2222
cat <<"EOF"
2323
Options:
24-
<dest_node> Destination node IP
24+
<dest_node> Destination node name or IP address
25+
dest_node must start from the following letters:
26+
ASCII letters 'a' through 'z' or 'A' through 'Z',
27+
the digits '0' through '9', or hyphen ('-')
2528
-u, --user <sshuser> SSH User name
2629
-i, --identity <identity_file> Identity key file
2730
-p, --pubkey <pub_key_file> Public key file
@@ -65,7 +68,7 @@ EOF
6568

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

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

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

0 commit comments

Comments
 (0)