Kevin_306

38 k8s-20.K8s基础篇-配置管理1.2 基于文件创建

1.2 基于文件创建

01.[root@k8s-master01 configmap]# vim conf/redis.conf
password redis123       (#随便输入的内容)
02.[root@k8s-master01 configmap]# ls conf/
game2.conf game.conf redis.conf
03.[root@k8s-master01 configmap]# kubectl create cm cmfromfile --from-file=conf/redis.conf 
configmap/cmfromfile created
04.[root@k8s-master01 configmap]# kubectl get cm
05.[root@k8s-master01 configmap]# kubectl get cm cmfromfile -o yaml
apiVersion: v1
data:
  redis.conf: |
    password redis123
kind: ConfigMap
metadata:
  creationTimestamp: "2022-02-23T07:56:21Z"
  managedFields:
  - apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
      f:data:
        .: {}
        f:redis.conf: {}
    manager: kubectl-create
    operation: Update
    time: "2022-02-23T07:56:21Z"
  name: cmfromfile
  namespace: default
  resourceVersion: "692472"
  uid: 9413516f-dab3-4ee8-aaa7-48a3d86ce3bd

 

 

posted on 2022-05-31 22:05  熊猫小虾  阅读(49)  评论(0编辑  收藏  举报

导航