<p>All system services in Kubernetes are deployed to a namespace, usually called <code>kube-system</code>. Where does that come from? What if I would like to change that to another namespace?</p>

<blockquote>
<p>All system services in Kubernetes are deployed to a namespace, usually called kube-system. Where does that come from?</p>
</blockquote>
<p>As noted in <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/" rel="nofollow noreferrer">the nice documentation</a> there are three namespaces that Kubernetes initially starts wtih:</p>
<ul>
<li><strong>default</strong> - The default namespace for objects with no other namespace.</li>
<li><strong>kube-system</strong> - The namespace for objects created by the Kubernetes system.</li>
<li><strong>kube-public</strong> - The namespace is created automatically and readable by all users (including those not authenticated). This namespace is mostly reserved for cluster usage, in case that some resources should be visible and readable publicly throughout the whole cluster. The public aspect of this namespace is only a convention, not a requirement.</li>
</ul>
<p>You can change <code>default</code> namespace to any namespace of your liking using <code>kubectl config</code> context handling.</p>
<blockquote>
<p>What if I would like to change that to another namespace?</p>
</blockquote>
<p>That would be a convoluted and rather risky undertaking... For kubeadm created cluster you can find appropriate manifests in /etc/kubernetes/manifests but it is not just sufficient to change namespace there, there is an array of config maps, certificates and things to consider namespace-wise. And even if you manage to do so there is reason behind the <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/" rel="nofollow noreferrer">deprication of api-server flag <code>master-service-namespace</code></a> since you can break GKE implicit references and similar issues can arise. It all boils down to that it is not really advisable to change kube-system namespace.</p>
<h1>Edit:</h1>
<p>Below is excerpt from <a href="https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/types.go" rel="nofollow noreferrer">kuberentes source</a> where you can see how those namespaces are initially defined.</p>
<pre><code>// NamespaceDefault means the object is in the default namespace which is applied when not specified by clients
NamespaceDefault string = &quot;default&quot;
// NamespaceAll is the default argument to specify on a context when you want to list or filter resources across all namespaces
NamespaceAll string = &quot;&quot;
// NamespaceNone is the argument for a context when there is no namespace.
NamespaceNone string = &quot;&quot;
// NamespaceSystem is the system namespace where we place system components.
NamespaceSystem string = &quot;kube-system&quot;
// NamespacePublic is the namespace where we place public info (ConfigMaps)
NamespacePublic string = &quot;kube-public&quot;
</code></pre>
<p>You can find <a href="https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/componentconfig/types.go" rel="nofollow noreferrer">more references to kube-system</a> through the codebase, here is another example:</p>
<pre><code>// &quot;kube-system&quot; is the default scheduler lock object namespace
SchedulerDefaultLockObjectNamespace string = &quot;kube-system&quot;
</code></pre>
<p>And so on...</p>
