Skip to content

Instantly share code, notes, and snippets.

@davidxia
Last active June 20, 2018 16:57
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 davidxia/b99a1a32754e66b85438e39a262e4d38 to your computer and use it in GitHub Desktop.
Save davidxia/b99a1a32754e66b85438e39a262e4d38 to your computer and use it in GitHub Desktop.
get k8s cluster's namespaces with httpie, jq, yq, gcloud, and fish shell
http GET \
(yq r ~/.kube/config -j | jq -r ".clusters[] | select(.name == \"$cluster_name\") | .cluster.server")/api/v1/namespaces \
'Authorization: Bearer '(\
gcloud config config-helper --format json | jq -r .credential.access_token
) \
--verify no \
| jq -r .items[].metadata.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment