<p>Manifest(yml) with kubernetes resource type(<code>kind: Namespace</code>) can be  applied through <code>kubectl</code> to create a virtual cluster</p>
<p>In our environment, manifest yaml's are applied using <code>kubectl</code> to create kubernetes resource types(deployment, service, autoscaling, ingress) under the given namespace</p>
<p>But, <a href="https://rancher.com/docs/rancher/v2.5/en/cluster-admin/projects-and-namespaces/#about-namespaces" rel="nofollow noreferrer">rancher</a> is used to create kubernetes resource type(<code>kind: Namespace</code> virtual cluster).</p>
<hr />
<p>What is the advantage of creating kubernetes resource type(<code>Namespace</code>) using rancher? instead of a manifest yaml applied through <code>kubectl</code></p>

overexchange
<p>Rancher uses concept of &quot;Project&quot; which is not present in &quot;vanilla&quot; kubernetes, which allows you to assign RBAC roles, PodSecurityPolicy etc to a group of namespaces in easy way.</p>
<p>If you are not using rancher to create projects and namespaces - you have to assign all these Roles and PSPs by yourself. For example, if you have default restricted policy on your cluster, namespace created by <code>kubectl create namespace foo</code> won't be able to run any pods by default, see <a href="https://rancher.com/docs/rancher/v2.5/en/admin-settings/pod-security-policies/" rel="nofollow noreferrer">https://rancher.com/docs/rancher/v2.5/en/admin-settings/pod-security-policies/</a></p>
<blockquote>
<p>Namespaces that are not assigned to projects do not inherit PSPs, regardless of whether the PSP is assigned to a cluster or project. Because these namespaces have no PSPs, workload deployments to these namespaces will fail, which is the default Kubernetes behavior.</p>
</blockquote>
<p>To sum it up, namespaces can be created using <code>kubectl create namespace</code> or manifests, but it might be cumbersome to make it all work well. Using rancher to provision namespaces is easier to maintain and troubleshoot.</p>
<p>As for advantages, having ability to group namespaces under &quot;project&quot; and assign resources, PSP and roles to a group of namespaces with rancher UI support is one of the main selling points of having rancher in a first place. <code>Namespace</code> objects  themselves are basically the same as anywhere else.</p>
