Get project names via kubectl

How to get project names via kubectl?

Iā€™m not sure how to do it via kubectl, but it is possible to get projects list with rancher cli with a short script (few commands).
I think I have something that I wrote if it is useful for you let me know and I will find it.

No as they are just annotations of the namespace with the project ID.

I did write a script to handle creating projects and assigning namespace to a project. It also does helpful things like generating a kubeconfig file as I mainly use this script as part of my pipelines.

I have managed to find a way to get list of project names via following curl command. You need jq tool to be able to query the json formatted output from curl command.

curl -k -u ${token} https://"${rancher_fqdn}"/v1/ | jq '.data[].spec.displayName'

1 Like