<p>Kubernetes by default adds a <code>kubernetes</code> service in the default namesapce. This allows access to the kubernetes API from any pod in that namespace.</p>

<p>For example, I can </p>

<pre><code>TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
kubectl exec -it $SOME_POD -- bash
curl -v https://kubernetes/api/v1/ \
  -H "Authorization: Bearer $TOKEN" \
  -k -v
</code></pre>

<p>And get something like:</p>

<pre><code>&lt; HTTP/1.1 200 OK
&lt; Content-Type: application/json
&lt; Date: Sat, 15 Jul 2017 22:16:09 GMT
&lt; Transfer-Encoding: chunked
&lt;
{
  "kind": "APIResourceList",
  "groupVersion": "v1",
  "resources": [
    {
      "name": "bindings",
      "namespaced": true,
  ...
</code></pre>

<p>If I create a new namespace, there is no <code>kubernetes</code> service by default. I'm trying to create one by using the following resource service definition (basically copied from the default namespace): </p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    component: apiserver
    provider: kubernetes
  name: kubernetes
  resourceVersion: "12"
spec:
  ports:
  - name: https
    port: 443
    protocol: TCP
    targetPort: 443
  sessionAffinity: ClientIP
  type: ClusterIP
</code></pre>

<p>But this doesn't seem to work since there seems to be tied to any pod.</p>

<p>Basically, I want the same behavior as in the <code>default</code> namespace in a newly created namespace.</p>

<p>Current Version:</p>

<pre><code>{
  "major": "1",
  "minor": "5",
  "gitVersion": "v1.5.7",
  "gitCommit": "8eb75a5810cba92ccad845ca360cf924f2385881",
  "gitTreeState": "clean",
  "buildDate": "2017-04-27T09:42:05Z",
  "goVersion": "go1.7.5",
  "compiler": "gc",
  "platform": "linux/amd64"
}
</code></pre>

<p>You can access the <code>kubernetes</code> service from other namespaces by qualifying the hostname:</p>

<p>The hostnames <code>kubernetes.default.svc</code>, <code>kubernetes.default.svc.cluster.local</code>, and the IP contained in <code>$KUBERNETES_SERVICE_HOST</code> will all resolve to the kubernetes API service from any namespace.</p>

<p>Following your example, you could do this from any namespace:</p>

<pre><code>TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
kubectl exec -it $SOME_POD -- bash
curl -v https://kubernetes.default.svc/api/v1/ \
  -H "Authorization: Bearer $TOKEN" 
  -k -v
</code></pre>
