您的位置 首页 k8s

k8s -configMap-configmap

configMap对应用程序的配置文件进行单独挂载

 

demo:

apiVersion: v1
kind: Pod
metadata:
  name: games-cm-008
spec:
  nodeName: worker233
  # hostNetwork: true
  volumes:
  - name: data01
    configMap:
      name: nginx-conf
  containers:
  - name: games
    image: games:v0.5
    volumeMounts:
    - name: data01
      mountPath: /etc/nginx/conf.d/

 

ConfigMap -案例1

apiVersion: v1
kind: ConfigMap
metadata:
  name: games-conf
# 指定cm的数据
data:
  # 键值对的数据类型
  class: linux86
  school: baimei
  
  # 类文件数据类型
  student.info: |
    name: wangbinbin
    hobby: "吃冰棍,梭罗冰棍,添冰棍,含冰棍,吐冰棍"
    address: "JiaoShi03"
    school: "baimei"
    age: 30

  mysql.cfg: |
    datadir: /baimei/data/mysql80
    basedir: /baimei/softwares/mysql80
    port: 3306
    socket: /var/lib/mysql80/mysql.sock

 

ConfigMap -案例2

apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-conf
# 指定cm的数据
data:
  games.conf: |
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/bird/;
          server_name   game01.baimei.com;
      }
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/pinshu/;
          server_name   game02.baimei.com;
      }
      
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/tanke/;
          server_name   game03.baimei.com;
      }
      
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/chengbao/;
          server_name   game04.baimei.com;
      }
      
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/motuo/;
          server_name   game05.baimei.com;
      }
      
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/liferestart/;
          server_name   game06.baimei.com;
      }
      
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/huangjinkuanggong/;
          server_name   game07.baimei.com;
      }
      
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/feijidazhan/;
          server_name   game08.baimei.com;
      }
      
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/zhiwudazhanjiangshi/;
          server_name   game09.baimei.com;
      }
      
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/xiaobawang/;
          server_name   game10.baimei.com;
      }
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/pingtai/;
          server_name   game11.baimei.com;
      }
      
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/dayu/;
          server_name   game12.baimei.com;
      }
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/maliao/;
          server_name   game13.baimei.com;
      }
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/menghuanmonizhan/;
          server_name   game14.baimei.com;
      }
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/qieshuiguo/;
          server_name   game15.baimei.com;
      }
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/wangzhezhicheng/;
          server_name   game16.baimei.com;
      }
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/zhiwuVSjiangshi/;
          server_name   game17.baimei.com;
      }
      server {
          listen        0.0.0.0:99;
          root          /usr/local/nginx/html/killbird/;
          server_name   game18.baimei.com;
      }

 

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章