diff --git a/CHANGELOG.md b/CHANGELOG.md index c76d24a..abe5508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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" diff --git a/README.md b/README.md index 54964bf..7602471 100644 --- a/README.md +++ b/README.md @@ -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 @@ -89,7 +89,10 @@ Usage: kubectl ssh-jump [options] Options: - Destination node IP + 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 SSH User name -i, --identity Identity key file -p, --pubkey Public key file @@ -134,7 +137,10 @@ Usage: kubectl ssh-jump [options] Options: - Destination node IP + 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 SSH User name -i, --identity Identity key file -p, --pubkey Public key file @@ -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: @@ -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. diff --git a/VERSION b/VERSION index 0d91a54..d15723f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.0 +0.3.2 diff --git a/kubectl-ssh-jump b/kubectl-ssh-jump index 920be03..c13bec8 100755 --- a/kubectl-ssh-jump +++ b/kubectl-ssh-jump @@ -21,7 +21,10 @@ help(){ options(){ cat <<"EOF" Options: - Destination node IP + 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 SSH User name -i, --identity Identity key file -p, --pubkey Public key file @@ -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 "" } @@ -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} \ @@ -189,7 +192,7 @@ plugin_main() { sshargs="$2" nSkip=2 ;; - [a-z]*) + [0-9a-zA-Z-]*) destnode=$1 ;; *)