首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >库贝克尔:如何从命令行创建持久化卷的清单?

库贝克尔:如何从命令行创建持久化卷的清单?
EN

Stack Overflow用户
提问于 2021-02-19 19:37:43
回答 1查看 1.1K关注 0票数 1

可以从命令行创建(启动清单) pv/pvc吗?

ie.创建部署

代码语言:javascript
复制
kubectl create deployment abc --image=logger:1 --dry-run=client -o yaml > abc.yml

ie.创建一个pod

代码语言:javascript
复制
kubectl run pod xyz --image=logger:1 --dry-run=client -o yaml > xyz.yml

我想做什么,

代码语言:javascript
复制
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

EN

回答 1

Stack Overflow用户

发布于 2021-02-19 19:45:05

代码语言:javascript
复制
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. 

     --->kubectl create [press tab] [press tab] 
    clusterrole          cronjob              namespace            quota                secret               
    clusterrolebinding   deployment           poddisruptionbudget  role                 service              
    configmap            job                  priorityclass        rolebinding          serviceaccount   

或者可以使用--helpkubectl create检查可用的选项。

代码语言:javascript
复制
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

注意:

上面的

  1. 信息用于v1.24.2或更低版本。这可能与未来的releases.
  2. kubectl create token不同,在1.24版中添加了
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66283989

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档