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

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

kubectl  create configmap

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

configmap 用来保存一个或多个key/value信息。

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

当基于目录创建configmap时,key还是文件的基础名称,目录中每个配置文件名都被设置为key,文件内容设置为value。

语法

$ configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]

示例

根据文件创建一个名为my-config的configmap

kubectl create configmap my-config --from-file=path/to/bar

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

kubectl create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt

使用key1 = config1和key2 = config2创建一个名为my-config的configmap

kubectl create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2

从文件中的key = value对创建一个名为my-config的configmap

kubectl create configmap my-config --from-file=path/to/bar

从env文件创建一个名为my-config的configmap

kubectl create configmap my-config --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 configmap (i.e. a Docker .env file).
from-file   [] Key file can be specified using its file path, in which case file basename will be used as configmap key, or optionally with a key and file path, in which case the given key will be used. Specifying a directory will iterate each named file in the directory whose basename is a valid configmap key.
from-literal   [] Specify a key and literal value to insert in configmap (i.e. mykey=somevalue)
generator   configmap/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].
validate   true If true, use a schema to validate the input before sending it

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

最新文章

  1. 药理学css概念,药理学css 名词解释
  2. jQuery.post() 函数格式详解
  3. android点击改变背景色的动画,Lottie-android 修改动画颜色
  4. 机器学习能诊断病情,还能预测患者出院后的情况?
  5. 第16/24周 SQL Server 2014中的基数计算
  6. python子进程kerberos_Anaconda3的python找不到kerberos凭证缓存
  7. 315记者卧底销售公司成为二把手:待遇比原来高多了,差点不想回来
  8. 快去换电池!苹果召回6.3万台MacBook Pro 有你的吗?
  9. 国内首个比特币勒索病毒案告破,三年获利 500 万!
  10. 数据结构上机实践第七周项目1 - 自建算法库——顺序环形队列
  11. java中4种修饰符访问权限的区别
  12. winform使用字体图标
  13. 苹果iPhone手机升级系统内存空间变小不够如何解决?
  14. 学习笔记 Tianmao 篇 recyclerView 辅助的RecycleAdapterImpl类(适配自定义 模板)
  15. ue4 项目模板_卡牌游戏项目模板
  16. 解决DoubanFM第三方客户端UI线程与工作线程交互问题
  17. python画五角星代码_Python使用turtule画五角星的方法
  18. 学习安装unik环境——过程一
  19. VUE 项目更新部署时,浏览器页面缓存问题
  20. 在校外,如何免费下载知网上的文献论文的方法

热门文章

  1. Churchman University简介:
  2. MongoDB 教程五: MongoDB固定集合和性能优化
  3. sed 执行错误:sed: 1: “…”: Invalid command code f
  4. php命令行用法简介
  5. 时区日期处理及定时 (NSDate,NSCalendar,NSTimer,NSTimeZone) -- IOS(实例)
  6. 有关UIView、subview的几个基础知识点-IOS开发 (实例)
  7. ACM常用数列(斐波那契数列、卡特兰数、贝尔数、斯特灵数)
  8. C++——拷贝构造函数和赋值函数的注意点
  9. 《剑指Offer》 从上往下打印出二叉树
  10. 【Processing学习笔记】安装与入门