configMap简单理解 + operator的理解

1.简单例子-configmap

apiVersion: v1
kind: ConfigMap
metadata:
  name: demo-wpp-configmap
data:
  mysql_host: "106.14.13.62"

2.包含配置文件的configmap

apiVersion: v1
kind: ConfigMap
metadata:
  name: filebeat-config
  labels:
    k8s-app: filebeat
data:
  filebeat.yml: |-
    filebeat.prospectors:
    - type: log
      paths:
        - /logdata/*.log
      tail_files: true
      fields:
        pod_name: '${pod_name}'
        POD_IP: '${POD_IP}'
    output.file:
      path: "/tmp/filebeat"
      filename: filebeat
      codec.format:
        string: '%{[@timestamp]} %{[message]} pod_name %{[fields][pod_name]} %{[fields][POD_IP]}'

3.作为volume挂载使用    

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nginx-configmap
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx-configmap
    spec:
      containers:
      - name: nginx-configmap
        image: nginx
        ports:
        - containerPort: 80
        volumeMounts:     
        - name: config-volume4
          mountPath: /tmp/config4
      volumes:
      - name: config-volume4
        configMap:
          name: test-config4
————————————————
https://blog.csdn.net/liukuan73/article/details/79492374
-------------------------------------------------------------
把configmap当作一个卷

 


 https://blog.csdn.net/engchina/article/details/88531358

posted @ 2020-01-05 13:20  littlevigra  阅读(907)  评论(2编辑  收藏  举报