Kubernetes ConfigMap

July 4, 2023

You can define a ConfigMap in the Helm chart which will provide a file to the Kubernetes Deployment docker image. An example of this is apache config:

{{ $env := .Values.global.env }}
apiVersion: v1
kind: ConfigMap
  name: "{{ $env }}-{{ .Chart.Name }}-apache-config"
  my-app-apache.conf: |
    <VirtualHost *:80>
        ServerName my-app

        DocumentRoot /home/my-app/www
        <Directory /home/my-app/www>
            Options -Indexes +FollowSymLinks +MultiViews
            AllowOverride All
            Require all granted
            DirectoryIndex index.php

        <FilesMatch \.php$>
            SetHandler  "proxy:fcgi://localhost:9080"

        ErrorLog /dev/stdout
        CustomLog /dev/stdout combined

Logs are pushed to stdout and from there they will automatically be picked up and placed in New Relic.