1. 程式人生 > 其它 >|NO.Z.00172|——————————|CloudNative|——|KuberNetes&配置管理.V03|-------------------------------------------------------|configmap.v03|從檔案值建立configmap|

|NO.Z.00172|——————————|CloudNative|——|KuberNetes&配置管理.V03|-------------------------------------------------------|configmap.v03|從檔案值建立configmap|



[CloudNative:KuberNetes&配置管理.V03]                                                               [Applications.KuberNetes] [|DevOps|k8s|配置管理|k8s配置管理ConfigMap|]








一、從檔案值建立configmap
### --- 根據檔案值建立configmap
~~~     可以將kubectl create configmap其與--from-literal引數一起使用,
~~~     以從命令列定義文字值

[root@k8s-master01 configmap]# kubectl create configmap special-config --from-literal=special.how=very --from-literal=special.type=charm
configmap/special-config created
### --- 檢視建立的special-config.yaml配置檔案

[root@k8s-master01 configmap]# kubectl get cm special-config -oyaml
apiVersion: v1
data:
  special.how: very
  special.type: charm
kind: ConfigMap
metadata:
  creationTimestamp: "2021-04-24T10:24:11Z"
  managedFields:
  - apiVersion: v1
    manager: kubectl-create
    operation: Update
    time: "2021-04-24T10:24:11Z"
  name: special-config
  namespace: default
  resourceVersion: "643220"
  uid: 70931d23-acd6-41df-806d-b9902db94e33








===============================END===============================


Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart                                                                                                                                                    ——W.S.Landor



來自為知筆記(Wiz)