创建 PersistentVolumeClaim 命令方式?

问题描述

为什么我们不能以命令方式创建 PV 或 PVC?

尝试使用 create 命令,但它没有显示任何一个

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
   

解决方法

documentation kubectl 中所述,使用命令式命令内置于 kubectl 命令行工具,以帮助您快速创建对象。

经过一些检查后,这似乎不可用,因为它尚未实施。您可以在 kubectl/pkg/cmd/create 中查看创建选项的完整列表。 例如,#78153 负责 kubectl create ingress 功能。

您可能会通过询问开发人员并打开 new issue 来获得更多信息以及为什么未实现此功能的原因。