configMap简单理解

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

猜你喜欢

转载自www.cnblogs.com/hixiaowei/p/12152162.html
今日推荐