<p>How do I get the current namespace of a deployment/service using the kubernetes client-go API? It doesn't seem to be in the client object or in the config.</p>

<p>Using</p>

<pre><code>ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
</code></pre>

<p>works but is ugly, when the desired implementation is present in the <code>Namespace()</code> method of <code>inClusterClientConfig</code>. But how would you get that object starting from  <code>rest.InClusterConfig()</code>? It is only instantiable from outside the package via <code>NewNonInteractiveDeferredLoadingClientConfig</code>.</p>

<p>I see <a href="https://github.com/kubernetes/kubernetes/pull/63707" rel="noreferrer">kubernetes #63707</a> which looks related but was abandoned.</p>
