Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

How to get the port number of the Server IP address of a k8s cluster using the info of the kubeconfig file

clusterName="kind-kind"
kubectl config view -o json | \
     jq '.clusters[] | select(.name=="'$clusterName'").cluster.server' | \
     sed -e 's,^.*:,:,g' -e 's,.*:\([0-9]*\).*,\1,g'
50211

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment