I am trying to select a specific server URL from kubectl config view
kubectl config view -o jsonpath='{.clusters[?(@.name == 'dev')].cluster. Server}'
However, this fails with:
error: error executing jsonpath "{.clusters[?(@.name == dev)].cluster.server}": Error executing template: unrecognized identifier dev. Printing more information for debugging the template:
template was:
{.clusters[?(@.name == dev)].cluster. Server}
I tested this with JSONpath.com and it's apparently valid.
What am I doing wrong?
Change the single quotes around dev
to double quotes:
kubectl config view -o jsonpath='{.clusters[?(@.name == "dev")].cluster.server}'
You can see an example here.