Skip to content

Instantly share code, notes, and snippets.

@tyrannasaurusbanks
Last active August 15, 2019 14:36
Show Gist options
  • Save tyrannasaurusbanks/163dc87310434a2ef99bb8f912e93d75 to your computer and use it in GitHub Desktop.
Save tyrannasaurusbanks/163dc87310434a2ef99bb8f912e93d75 to your computer and use it in GitHub Desktop.
Shell onto nodes in cluster
# SSH onto node hosting last-created pod
kubectl get pods -n mantle -l=app=mantle-node-problem-detector -o jsonpath='{.items[0].status.hostIP}' --sort-by="metadata.creationTimestamp" | tail -n1 | xargs -0 bash -ic 'csshx -y 2 -x 2 -l core $@' --
# SSH onto master
kubectl get nodes -l=kubernetes.io/role=master -o jsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}' | xargs -0 bash -ic 'csshx -y 2 -x 2 -l core $@' --
# SSH onto every node
kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}' | xargs -0 bash -ic 'csshx -y 2 -x 2 -l core $@' --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment