<p>I'm looking to create yaml files for specific resources (pvs, pvcs, policies and so on) via the command line with <code>kubectl</code>. </p>

<p><code>kubectl create</code> only supports the creation of certain resource types (namely  clusterroles, clusterrolebindings, configmaps, cronjobs, deployments, jobs, namespaces, pod disruption budgets, priorityclasses,  quotas, roles, rolebindings, secrets, services and serviceaccounts). </p>

<p>Why doesn't it support pods, pvs, pvcs, etc?</p>

<p>I know of <code>kubectl run --generator=run=pod/v1</code> for pods, but is there a specific reason it  hasn't been added to <code>kubectl create</code>?</p>

<p>I searched the docs and github issues, but couldn't find an explanation.</p>

<p>I know of tools like ksonnet, but I was wondering if there is a native way (or a reason why there isn't).</p>

char
<p>You can create <strong>any type</strong> of object with <code>kubectl create</code>. To do that you have two solutions :  </p>

<ol>
<li>Using a file descriptor : <code>kubectl create -f my-pod-descriptor.yml</code></li>
<li>Using stdin (where your file content is in fact in your console) :  </li>
</ol>

<pre class="lang-sh prettyprint-override"><code>cat &lt;&lt;EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: busybox-sleep
spec:
  containers:
  - name: busybox
    image: busybox
    args:
    - sleep
    - "1000000"
EOF
</code></pre>

<p>Now back to the question, as to why didn't they add a <code>kubectl create pod</code> command for example. I don't really have the answer.<br>
My guess is because it is not really a good practice to manage <strong>pods</strong> directly. It is recommended to use <strong>deployments</strong> instead. And you have a <code>kubectl create deployment</code> command.</p>

<p>What about other objects wich are perfectly fine such as <strong>pv or pvc</strong>. Well, I don't know :)</p>

<p>Just keep in mind that it is not really a good practice to create/manage everything from the console, as you won't be able to keep the history of what you are doing. Prefer using files managed in a SCM.  </p>

<p>Thus, I guess the K8S team is not putting too much an effort in a procedure or command that is not recommended. Which is fine to me.</p>
