如何解决Kubectl:如何从命令行创建持久卷的清单?
是否可以从命令行创建(启动清单)pv/pvc?
即。创建部署
kubectl create deployment abc --image=logger:1 --dry-run=client -o yaml > abc.yml
即。创建 Pod
kubectl run pod xyz --image=logger:1 --dry-run=client -o yaml > xyz.yml
我想做什么
kubectl create persitentvolume --name my-pv spec.capacity.storage=1Gi --dry-run=client -o yaml > my-pv.yml
使用的参考: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands
解决方法
我们无法使用命令行为 pv
创建清单文件。只有以下使用命令行(强制)创建的对象是可能的。
--->kubectl create [press tab] [press tab]
clusterrole cronjob namespace quota secret
clusterrolebinding deployment poddisruptionbudget role service
configmap job priorityclass rolebinding serviceaccount
或者您可以将 --help
与 kubectl create
一起使用来检查可用选项。
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.
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
注意:以上信息适用于 v1.19.0
或以下。这可能会因未来版本而异。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。