ConfigMap

一.创建

使用指令kubectl创建ConfigMap

 
kubectl create configmap fortune-config --from-literal=sleep-interval=25

  configmap名称:fortune-config
  映射条目:sleep-interval=25


使用指令kubectl创建多个条目的ConfigMap
kubectl create configmap fortune-config --from-literal=sleep-interval=25   --from-literal=foo=bar
 

查看ConfigMap的Yaml格式的定义描述

[rancher@rancher-0 ~]$ kubectl  get configmap fortune-config -o yaml
apiVersion: v1
data:
  sleep-interval: "25"  #映射的唯一条目
kind: ConfigMap
metadata:
  creationTimestamp: "2019-05-31T07:56:12Z"
  name: fortune-config
  namespace: default
  resourceVersion: "6360635"
  selfLink: /api/v1/namespaces/default/configmaps/fortune-config
  uid: 8f2c4de0-8379-11e9-b3bc-000c29fd1fbc 

通过Kubernetes API来创建:

kubectl create -f  fortune-config.yaml

  

猜你喜欢

转载自www.cnblogs.com/wanghui0412/p/11018402.html