Skip to content

Example: ConfigMap

Stéphane Brunner edited this page Jun 1, 2024 · 6 revisions

Create a ConfigMap with one value and use it in a container as an environment variable.

configMaps:
  content:
    data1: 
      value: value1

services:
  deployment1:
    enabled: true
    containers:
      container1:
        image:
          repository: camptocamp/image
          tag: latest
        env:
          env1:
            type: configMap
            name: self
            key: data1

Create a ConfigMap with one JSON file to be mounted in a container.

configMaps:
  content:
    data1: 
      type: json
      value: value1

services:
  deployment1:
    enabled: true    
    containers:
      container1:
        image:
          repository: camptocamp/image
          tag: latest
        volumeMounts:
          /tmp/file1.json:
            name: volume1
            subPath: data1.json
            readOnly: true
    volumes:
      volume1:
        configMap:
          items:
            - key: data1
              path: data1.yaml

Clone this wiki locally