// cm是configmaps的缩写 01.[root@k8s-master01 configmap]# kubectl create cm cmfromdir --from-file=conf/ configmap/cmfromdir created 02.[root@k8s-master01 configmap]# kubectl get cm NAME DATA AGE cmfromdir 2 7skube-root-ca.crt 1 43h 03.[root@k8s-master01 configmap]# kubectl get cm cmfromdir -o yaml apiVersion: v1 data: game.conf: | lives=3 secret.code=true game2.conf: | color.good=purple user=tomcat kind: ConfigMap metadata: creationTimestamp: "2022-02-23T07:47:24Z" managedFields: - apiVersion: v1 fieldsType: FieldsV1 fieldsV1: f:data: .: {} f:game.conf: {} f:game2.conf: {} manager: kubectl-create operation: Update time: "2022-02-23T07:47:24Z" name: cmfromdir namespace: default resourceVersion: "691057" uid: 8e958403-7b46-4c19-95d9-91de8a50d1d8 04.//查看conf配置文件的内容显示的一样 [root@k8s-master01 configmap]# cat conf/game.conf
搜索
复制