Skip to content

Instantly share code, notes, and snippets.

@devniel
Created October 24, 2020 21:54
Show Gist options
  • Save devniel/70cd5d00dc2ab5cc47a4bacd8cc97724 to your computer and use it in GitHub Desktop.
Save devniel/70cd5d00dc2ab5cc47a4bacd8cc97724 to your computer and use it in GitHub Desktop.
Print K8S API port
#!/bin/bash
regex=":([[:digit:]]+)\/"
cluster_info=$(kubectl cluster-info)
[[ $cluster_info =~ $regex ]]
port="${BASH_REMATCH[1]}"
echo "Kubernetes API port: ${port}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment