<p>Can anyone tell me how to list all namespaces in k8s using Go? I have been referencing this link but couldn't find anything that can list all namespaces.</p>
<p>Link: <a href="https://pkg.go.dev/github.com/gruntwork-io/terratest/modules/k8s" rel="nofollow noreferrer">https://pkg.go.dev/github.com/gruntwork-io/terratest/modules/k8s</a></p>
<p>I don't see any <code>ListNamespaces</code> functions for the k8s package in Go.</p>

TechGirl
<p>Try <a href="https://github.com/kubernetes/client-go/tree/master/examples" rel="noreferrer">kubernetes/client-go</a>, you can do like <code>clientset.CoreV1().Namespaces(&quot;&quot;).List(context.TODO(), metav1.ListOptions{})</code>. Your <code>clientset</code> maybe instantiate within the cluster or outside.</p>
