<p>Is it possible to create (start the manifest) of a pv/pvc from command line?</p>
<p><strong>ie. Creating a deployment</strong></p>
<pre><code>kubectl create deployment abc --image=logger:1 --dry-run=client -o yaml &gt; abc.yml
</code></pre>
<p><strong>ie. Creating a pod</strong></p>
<pre><code>kubectl run pod xyz --image=logger:1 --dry-run=client -o yaml &gt; xyz.yml
</code></pre>
<p><strong>What I'm trying to do</strong></p>
<pre><code>kubectl create persitentvolume --name my-pv spec.capacity.storage=1Gi --dry-run=client -o yaml &gt; my-pv.yml
</code></pre>
<p><em>References used :</em>
<a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands</a></p>

JumbledCode
<pre><code>We cannot create the manifest file for `pv` using the command line. For only the following objects created using the command line(imperatively) is possible. 

     ---&gt;kubectl create [press tab] [press tab] 
    clusterrole          cronjob              namespace            quota                secret               
    clusterrolebinding   deployment           poddisruptionbudget  role                 service              
    configmap            job                  priorityclass        rolebinding          serviceaccount   
</code></pre>
<p>or you can use <code>--help</code> with <code>kubectl create</code> to check the available options.</p>
<pre><code>Available Commands:
  clusterrole           Create a cluster role
  clusterrolebinding    Create a cluster role binding for a particular cluster role
  configmap             Create a config map from a local file, directory or literal value
  cronjob               Create a cron job with the specified name
  deployment            Create a deployment with the specified name
  ingress               Create an ingress with the specified name
  job                   Create a job with the specified name
  namespace             Create a namespace with the specified name
  poddisruptionbudget   Create a pod disruption budget with the specified name
  priorityclass         Create a priority class with the specified name
  quota                 Create a quota with the specified name
  role                  Create a role with single rule
  rolebinding           Create a role binding for a particular role or cluster role
  secret                Create a secret using specified subcommand
  service               Create a service using a specified subcommand
  serviceaccount        Create a service account with the specified name
  token                 Request a service account token
</code></pre>
<p>Note:</p>
<ol>
<li>Info above is for <code>v1.24.2</code> or below. This might differ with future releases.</li>
<li><code>kubectl create token</code> is added in version 1.24.</li>
</ol>
