<p>I am reading on <code>k8s</code> it has 2 method to use it. Both of them are complement of each other.</p>

<p>Today I tried one feature to get a declarative (manifest file).</p>

<p>Suppose I create <code>namespace</code> instance</p>

<pre class="lang-sh prettyprint-override"><code>$ kubectl create namespace cert-manager
namespace/cert-manager created
</code></pre>

<p>Then I export the manifest file for using declarative method next time</p>

<p><code>kubectl get namespace cert-manager -o yaml --export &gt; cert-manager.yaml</code></p>

<p><code>cert-manager.yaml</code></p>

<pre><code>apiVersion: v1
kind: Namespace
metadata:
  creationTimestamp: null
  name: cert-manager
  selfLink: /api/v1/namespaces/cert-manager
spec:
  finalizers:
  - kubernetes
status:
  phase: Active
</code></pre>

<p>Compare with other example</p>

<pre><code>apiVersion: v1
kind: Namespace
metadata:
  name: nginx-ingress
</code></pre>

<p><strong>Question</strong></p>

<p>Is 2nd shorter manifest file correctly done?</p>

joe
<p>Yes, your 2nd manifest file is correct.</p>

<p>The <code>spec</code> describes your desired state for the object–the characteristics that you want the object to have. The <code>status</code> describes the actual state of the object, and is supplied and updated by the Kubernetes system.</p>

<p><code>Namespace</code> object has only one optional field <code>finalizers</code>, which allows observables to purge resources whenever the namespace is deleted.</p>

<p>So, the simplest <a href="https://kubernetes.io/docs/tasks/administer-cluster/namespaces/#creating-a-new-namespace" rel="nofollow noreferrer">namespace manifest file</a> is the following:</p>

<pre><code>apiVersion: v1
kind: Namespace
metadata:
  name: &lt;namespace-name&gt;
</code></pre>
