当前位置: 首页 > news >正文

无锡锡山网站建设网站维护公告模板

无锡锡山网站建设,网站维护公告模板,免费平面设计模板网站,wordpress 段落显示不全回到目录 一般用于去存储 Pod 中应用所需的一些配置信息#xff0c;或者环境变量#xff0c;将配置于 Pod 分开#xff0c;避免应为修改配置导致还需要重新构建 镜像与容器。 1 创建ConfigMap #使用 kubectl create configmap -h 查看示例#xff0c;构建 configmap 对象…回到目录 一般用于去存储 Pod 中应用所需的一些配置信息或者环境变量将配置于 Pod 分开避免应为修改配置导致还需要重新构建 镜像与容器。 1 创建ConfigMap #使用 kubectl create configmap -h 查看示例构建 configmap 对象 Examples:# Create a new config map named my-config based on folder barkubectl create configmap my-config --from-filepath/to/bar# Create a new config map named my-config with specified keys instead of file basenames on diskkubectl create configmap my-config --from-filekey1/path/to/bar/file1.txt --from-filekey2/path/to/bar/file2.txt# Create a new config map named my-config with key1config1 and key2config2kubectl create configmap my-config --from-literalkey1config1 --from-literalkey2config2# Create a new config map named my-config from the keyvalue pairs in the filekubectl create configmap my-config --from-filepath/to/bar# Create a new config map named my-config from an env filekubectl create configmap my-config --from-env-filepath/to/foo.env --from-env-filepath/to/bar.env 1.1 将指定目录下所有文件加载到配置文件中 # Create a new config map named my-config based on folder bar # kubectl create configmap my-config --from-filepath/to/bar #example: #在test目录下有两个配置文件db.properties redis.properties#1.创建configmap名字为test-cm从test目录下加载 [rootk8s-master1 configmap]# kubectl create cm test-cm --from-filetest/ configmap/test-cm created#2.查看configmap [rootk8s-master1 configmap]# kubectl get cm NAME DATA AGE kube-root-ca.crt 1 5d9h #k8s默认的认证 test-cm 2 7s #我们创建的#3.查看test-cm的详细信息 [rootk8s-master1 configmap]# kubectl describe cm test-cm #内容如下 Name: test-cm Namespace: default Labels: none Annotations: noneDatadb.properties: #key ---- username: root password: 1234redis.properties: ---- port: 6379BinaryData Events: none 1.2 指定一个或多个文件和key # Create a new config map named my-config with specified keys instead of file basenames on disk # kubectl create configmap my-config --from-filekey1/path/to/bar/file1.txt --from-filekey2/path/to/bar/file2.txt#指定一个或多个文件不加key时以文件名作为key#example#创建configmap名称为testfile-cm从指定的test目录下的db.properties加载 [rootk8s-master1 configmap]# kubectl create cm testfile-cm --from-filetest/db.properties configmap/testfile-cm created#查看configmap [rootk8s-master1 configmap]# kubectl get cm NAME DATA AGE kube-root-ca.crt 1 5d10h testfile-cm 1 5s#查看详情 [rootk8s-master1 configmap]# kubectl describe cm testfile-cm Name: testfile-cm Namespace: default Labels: none Annotations: noneDatadb.properties: #不指定key以文件名为key如果指定则以具体指定作为key ---- username: root password: 1234BinaryData Events: none 1.3 命令上手动添加key-value # Create a new config map named my-config with key1config1 and key2config2 #kubectl create configmap my-config --from-literalkey1config1 --from-literalkey2config2#直接写入key和value#example#创建configmap名称为test-cm手动添加keyuservaluerootkeypasswordvalue1234 [rootk8s-master1 configmap]# kubectl create cm test-cm --from-literaluserroot --from-literalpassword1234 configmap/test-cm created [rootk8s-master1 configmap]# kubectl get cm NAME DATA AGE kube-root-ca.crt 1 5d10h test-cm 2 7s [rootk8s-master1 configmap]# kubectl describe cm test-cm Name: test-cm Namespace: default Labels: none Annotations: noneDatapassword: #key ---- 1234 #value user: #key ---- root #valueBinaryData Events: none 2 configmap的使用 在pod中 将configmap中的数据设置为容器的环境变量 将ConfigMap中的数据设置为命令行参数 使用Volume将ConfigMap作为文件或目录挂载 编写代码在 Pod 中运行使用 Kubernetes API 来读取 ConfigMap 将configmap挂载到容器中configmap变化容器自动更新 而 写入环境变量不会自动更新 2.1 配置到容器的环境变量中 # test-pod-configmap.yaml apiVersion: v1 kind: Pod metadata:name: test-pod-configmap spec:containers:- name: test-busyboximage: busyboximagePullPolicy: IfNotPresentargs:- sleep- 86400env: # env配置容器环境变量- name: KEY1 # 容器环境变量key为key1valueFrom: # value内容configMapKeyRef: # 通过configmap的key映射name: my-config # configmap的名称key: key1 # configmap中的key- name: KEY2valueFrom:configMapKeyRef:name: my-configkey: key2 2.2 设置为命令行参数 # test-pod-configmap-cmd apiVersion: v1 kind: Pod metadata:name: test-pod-configmap-cmd spec:containers:- name: test-busyboximage: busyboximagePullPolicy: IfNotPresentcommand: [ /bin/sh,-c,echo $(KEY1) $(KEY2)]env:- name: KEY1valueFrom:configMapKeyRef:name: my-configkey: key1- name: KEY2valueFrom:configMapKeyRef:name: my-configkey: key2restartPolicy: Never 2.3 将configmap挂载到容器中 # test-pod-projected-configmap-volume.yaml apiVersion: v1 kind: Pod metadata:name: test-pod-projected-configmap-volume spec:containers:- name: test-pod-busyboximage: busyboximagePullPolicy: IfNotPresentargs:- sleep- 86400volumeMounts: # 挂载- name: config-volume # 挂载的数据卷名mountPath: /projected-volume # 挂载到哪的路径readOnly: true # 只读权限volumes: # 数据卷- name: config-volume # 数据卷名称projected:sources:- configMap: # 数据卷为configmapname: my-config # 数据卷名
http://www.pierceye.com/news/152213/

相关文章:

  • 建设网站技术人员先进事迹无锡有哪些做网站的公司
  • 2016网站设计欣赏企业网站推广建设
  • 国外简洁的网站跨境电商服务平台有哪些
  • 国内做网站技术支持 网站建设
  • 绍兴做团购的网站织梦转易优cms
  • 百度 网站 质量度扬州市工程建设招标网
  • 营销网站建设流程图优化营商环境发言稿
  • 设计网站公司有哪些怎么做网店
  • 高端的网站设计费用外贸营销型网站建设平台
  • 买源码做网站简单嘛贵阳百度seo点击软件
  • 省建设注册管理网站网站的维护和推广
  • wordpress 插件站wordpress本地mp3
  • 爱站工具包的主要功能很有设计感的企业网站
  • 地下城钓鱼网站如何做iis添加网站无法访问
  • 招聘网站大全网站开发liucheng
  • erlang做网站优势深圳集团网站建设公司好
  • 烟台公司建网站seo网站推广 沈阳
  • 没有网站做APP企业网站模板建站
  • 国内炫酷的网站首页网站开发交易平台
  • 大型网站建设公司制作网站好大夫在线免费咨询
  • 有哪些设计的很优秀的网站诸暨市住房建设局网站
  • 建设网站网站建站延吉手机网站建设开发
  • 网站建设一意见08wordpress主题
  • 做网站备案不少天网络设计包括哪些
  • 仿腾讯视频网站源码个人制作网站工具
  • 泉州网站制作建设163注册企业邮箱
  • 漳州市建设局网站6热e国产-网站正在建设中-手机版
  • 给公司做网站数据分析江门网站设计制作
  • 怎么做新网站安宁网站建设熊掌号
  • com是什么网站网络科技公司可以去吗