Skip to content

Example: ConfigMap

Stéphane Brunner edited this page Jul 3, 2024 · 6 revisions

Values present in the metadata config map:

  • CHART_NAME with the chart name.
  • RELEASE_NAME with the release name.
  • RELEASE_NAMESPACE with the namespace.
  • WEB_HOST with the host of the first ingress.
  • SERVICE_<SERCICE>_NAME with the service name.
  • SERVICE_<SERVICE>_CONTAINER_<CONTAINER>_IMAGE_TAG with the tag of the service container image.

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