Skip to content

Instantly share code, notes, and snippets.



Last active Aug 18, 2019
What would you like to do?
k8s: find cluster names in kubectl configuration
// one-liner which converts YAML to JSON
function yaml2json {
python -c 'import sys, yaml, json; y=yaml.load(; print(json.dumps(y))'
function kubectl_clusters {
cat ~/.kube/config | yaml2json | jq '.clusters[].name' | sed 's/"//g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment