容器编排技术 -- Kubernetes kubectl create secret generic 命令详解

  • 1 kubectl create secret generic
  • 2 语法
  • 3 示例
  • 4 Flags

kubectl create secret generic

根据配置文件、目录或指定的literal-value创建secret。

secret可以保存为一个或多个key/value信息。

当基于配置文件创建secret时,key将默认为文件的基础名称,value默认为文件内容。如果基本名称的key无效,则可以指定另一个key。

当基于目录创建secret时,key还是文件的基础名称,目录中有效的key的每个文件都被打包到secret中,除了常规文件之外的任何目录条目都被忽略(例如subdirectories, symlinks, devices, pipes, etc)。

语法

$ generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]

示例

使用指定的keys创建一个名为my-secret的secret

kubectl create secret generic my-secret --from-file=ssh-privatekey=~/.ssh/id_rsa --from-file=ssh-publickey=~/.ssh/id_rsa.pub

用key1 = supersecret和key2 = topsecret创建一个名为my-secret的secret

kubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret

从env文件创建名为my-secret的secret

kubectl create secret generic my-secret --from-env-file=path/to/bar.env

Flags

Name Shorthand Default Usage
allow-missing-template-keys   true If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
dry-run   false If true, only print the object that would be sent, without sending it.
from-env-file     Specify the path to a file to read lines of key=val pairs to create a secret (i.e. a Docker .env file).
from-file   [] Key files can be specified using their file path, in which case a default name will be given to them, or optionally with a name and file path, in which case the given name will be used. Specifying a directory will iterate each named file in the directory that is a valid secret key.
from-literal   [] Specify a key and literal value to insert in secret (i.e. mykey=somevalue)
generator   secret/v1 The name of the API generator to use.
no-headers   false When using the default or custom-column output format, don't print headers (default print headers).
output o   Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath].
output-version     DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob').
save-config   false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
schema-cache-dir   ~/.kube/schema If non-empty, load/store cached API schemas in this directory, default is '$HOME/.kube/schema'
show-all a false When printing, show all resources (default hide terminated pods.)
show-labels   false When printing, show all labels as the last column (default hide labels column)
sort-by     If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
template     Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
type     The type of secret to create
validate   true If true, use a schema to validate the input before sending it

容器编排技术 -- Kubernetes kubectl create secret generic 命令详解相关推荐

  1. 容器编排技术 -- Kubernetes kubectl create secret docker-registry 命令详解

    容器编排技术 -- Kubernetes kubectl create secret docker-registry 命令详解 1 kubectl create secret docker-regis ...

  2. 容器编排技术 -- Kubernetes kubectl create secret tls 命令详解

    容器编排技术 -- Kubernetes kubectl create secret tls 命令详解 1 create secret tls 2 语法 3 示例 4 Flags create sec ...

  3. 容器编排技术 -- Kubernetes kubectl create service nodeport 命令详解

    容器编排技术 -- Kubernetes kubectl create service nodeport 命令详解 1 kubectl create service nodeport 2 语法 3 示 ...

  4. 容器编排技术 -- Kubernetes kubectl create service loadbalancer 命令详解

    容器编排技术 -- Kubernetes kubectl create service loadbalancer 命令详解 1 kubectl create service loadbalancer ...

  5. 容器编排技术 -- Kubernetes kubectl create service externalname 命令详解

    容器编排技术 -- Kubernetes kubectl create service externalname 命令详解 1 kubectl create service externalname ...

  6. 容器编排技术 -- Kubernetes kubectl create service clusterip 命令详解

    容器编排技术 -- Kubernetes kubectl create service clusterip 命令详解 1 kubectl create service clusterip 2 语法 3 ...

  7. 容器编排技术 -- Kubernetes kubectl create secret 命令详解

    容器编排技术 -- Kubernetes kubectl create secret 命令详解 1 kubectl create secret 2 语法 3 参考: kubectl create se ...

  8. 容器编排技术 -- Kubernetes kubectl create clusterrolebinding 命令详解

    容器编排技术 -- Kubernetes kubectl create clusterrolebinding 命令详解 1 kubectl create clusterrolebinding 2 语法 ...

  9. 容器编排技术 -- Kubernetes kubectl create serviceaccount 命令详解

    容器编排技术 -- Kubernetes kubectl create serviceaccount 命令详解 1 kubectl create serviceaccount 2 语法 3 示例 4  ...

最新文章

  1. SP10628 COT - Count on a tree (树剖+可持久化线段树)
  2. 面向动态环境基于点的语义SLAM系统
  3. SAP SD 基础知识之Cash Sales和Rush Order的区别
  4. OpenCV下设置灰度直方图的阈值来对图像进行查找(查表)变换的源码
  5. java中四种引用类型(对象的强、软、弱和虚引用)
  6. prometheus 基于文件的目标发现
  7. Django基于正则表达式的URL
  8. CEPH给用户创建读写权限
  9. python回测工具_Python爬虫回测股票的实例讲解
  10. php+条件限定符,const 限定符
  11. 剑指Offer - 面试题7. 重建二叉树(递归)
  12. 华为鸿蒙宣传悟空视频_华为自研鸿蒙系统定档9月?《悟空》微电影透露玄机...
  13. 一个求矩阵鞍点(即行上最小的数 同时是列上最大的数)的C程序
  14. 我一个弱女子在欧洲大街上拉屎了,因为便秘惹的祸
  15. 有趣 的java代码_[分享]几段有趣的JAVA代码
  16. vue实现消息提示框
  17. ng2 绑定输出html,Angular2的数据绑定
  18. hash 算法 (转)
  19. 灵遁者:写在33岁之初
  20. 中国互联网生态报告发布

热门文章

  1. Linux上的.NET框架Mono 2.0发布
  2. 教你买虚拟主机不会受骗的九个方法
  3. Memcache分布式部署方案
  4. ubuntu下中文输入法的安装--fcitx
  5. 如何在Ubuntu中屏蔽一个网站
  6. jquery jeditable 多选插件 (checkbox or select)
  7. Linux查看与修改时区、时间的命令
  8. NSURLConnection 下载数据 -- IOS(实例)
  9. 爬虫入门五(Phantomjs和selenium)
  10. LeetCode 653. Two Sum IV - Input is a BST