Search code examples
kuberneteskubectlpersistent-volumeskubernetes-pvcpersistent-volume-claims

Create PersistentVolumeClaim imperative way?


Why can't we create PV or PVC in imperative way?

Trying using create command, but it doesn't show any of them.

kubectl create --help

Available Commands:
  clusterrole         Create a ClusterRole.
  clusterrolebinding  Create a ClusterRoleBinding for a particular ClusterRole
  configmap           Create a configmap from a local file, directory or literal value
  cronjob             Create a cronjob 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 priorityclass with the specified name.
  quota               Create a quota with the specified name.
  role                Create a role with single rule.
  rolebinding         Create a RoleBinding for a particular Role or ClusterRole
  secret              Create a secret using specified subcommand
  service             Create a service using specified subcommand.
  serviceaccount      Create a service account with the specified name
   

Solution

  • As described in the documentation kubectl uses imperative commands built into the kubectl command-line tool in order to help you creating objects quickly.

    After some checks it seems like this is not available because it has not been implemented yet. You can see the full list of the create options at kubectl/pkg/cmd/create. For example, #78153 was responsible for kubectl create ingress functionality.

    You would probably get more information and perhaps reasons why this is not implemented by asking the developers and opening a new issue.