Can I a list all the namespaces using a role and not a clusterrole resource? If yes, can anyone help me with some example
Namespaces are cluster-wide objects.
The only way to access them is if there exists a ClusterRoleBinding and a corresponding ClusterRole that gives your principal (user, service account,etc) permissions to list namespaces.