1.

volumeMounts:name: fluentdmountPath: /fluentd/etcname: varlogmountPath: /var/logname: container1mountPath: /var/lib/docker/containersreadOnly: truesecurityContext:privileged: trueterminationGracePeriodSeconds: 30volumes:name: varloghostPath:path: /var/logname: container1hostPath:path: /var/lib/docker/containersname:  fluentdconfigMap:name: fluentd-config

Answer»

if the config map is mounted into the pod as a volume, it will automatically update not instantly and the files will change inside the CONTAINER. If it is an environment VARIABLE it stays as the old value until the container is restarted

For example: create a NEW config.yaml with your custom values

  • apiVersion: v1
  • kind: ConfigMap
  • metadata:
  • name: testconfig
  • namespace: default
  • data:
  • config.yaml: |
  • namespaces:
  • default
  • labels:
  • "app"
  • "owner"

Then create a pod definition, referencing the ConfigMap

  • apiVersion: v1
  • kind: Pod
  • metadata:
  • name: testobject
  • spec:
  • serviceAccountName: testobject
  • containers:
  • name: testobject
  • image: test/appv1
  • volumeMounts:
  • name: config-volume
  • mountPath: /app/config.yaml
  • subPath: config.yaml
  • volumes:
  • name: config-volume
  • configMap:
  • name: testconfig
  • restartPolicy: NEVER


Discussion

No Comment Found

Related InterviewSolutions