Skip to content

Instantly share code, notes, and snippets.

@abdennour
Created February 21, 2022 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abdennour/d820f46b35c93b85faf5a0020080ef15 to your computer and use it in GitHub Desktop.
Save abdennour/d820f46b35c93b85faf5a0020080ef15 to your computer and use it in GitHub Desktop.
Get Cluster CIDR Range - Kubernetes
# Credit: https://stackoverflow.com/a/61685899/747579
SVCRANGE=$(echo '{"apiVersion":"v1","kind":"Service","metadata":{"name":"tst"},"spec":{"clusterIP":"1.1.1.1","ports":[{"port":443}]}}' | kubectl apply -f - 2>&1 | sed 's/.*valid IPs is //')
echo $SVCRANGE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment