38 k8s-20.K8s基础篇-配置管理1.4 修改配置多个文件名称
01.//修改的时候前面加上自定义的名称(标注颜色),后面接的是本来的名字 [root@k8s-master01 configmap]# kubectl create cm cmspecialname2 --from-file=game-conf=conf/game.conf --from-file=redis-config=conf/redis.conf configmap/cmspecialname2 created [root@k8s-master01 configmap]# kubectl get cm cmspecialname2 -o yaml apiVersion: v1 data: game-conf: | lives=3 secret.code=true redis-config: | password redis123 kind: ConfigMap metadata: creationTimestamp: "2022-02-23T08:02:05Z" managedFields: - apiVersion: v1 fieldsType: FieldsV1 fieldsV1: f:data: .: {} f:game-conf: {} f:redis-config: {} manager: kubectl-create operation: Update time: "2022-02-23T08:02:05Z" name: cmspecialname2 namespace: default resourceVersion: "693381" uid: d52263a2-9a5a-4a8b-8831-7bb7bdc5ef34
02.//查看描述,获取 cm 中的全部数据 # kebectl describe cm cmspaceialname2
03.//获取所有的cm [root@k8s-master01 configmap]# kubectl get cm 04.//创建到其他命名空间 [root@k8s-master01 configmap]# kubectl create cm cmspecialname2 --from-file=game-conf=conf/game.conf --from-file=redis-config=conf/redis.conf -n kube-public configmap/cmspecialname2 created
05.// 之前创建的命名空间cmspecialname2 (45s前创建) [root@k8s-master01 configmap]# kubectl get cm -n kube-public 06.//新创建了命名空间cmspecialname2 (12s前创建) [root@k8s-master01 configmap]# kubectl get cm -n kube-public NAME DATA AGE cmspecialname2 2 45s
07.//有隔离性,不能跨命令空间的引用pod [root@k8s-master01 configmap]# vim conf/game.conf lives=3 secret.code=true test_env=dukuan