Configure Kubernetes

In this page we will cover how to configure Kubernetes as part of your Deployments.

Adding Volume Mounts to Pods

You can add arbitrary Kubernetes volume mounts to your Application Manager Deployment resources, for instance an NFS mount for use as a state backend, by adding an annotation in Deployment.spec.template.metadata.annotations with the key alpha/k8s-volume-mounts.

The expected value for this annotation is an array as follows:

[
  {
    "name": "volume-name",
    "volume": {
      # Same as Kubernetes Volume resource
    },
    "volumeMount": {
      # Same as Kubernetes VolumeMount resource
    }
  }
]

Please refer to the Kubernetes documentation for expected Volume and Volume Mount resources.

Example: Mounting an NFS and Secret

kind: Deployment
spec:
  template:
    metadata:
      annotations:
        alpha/k8s-volume-mounts: "
          [
            {
              'name': 'my-volume',
              'volume': {
                'nfs': {
                  'server': '10.1.2.3',
                  'path': '/daplatform-foo'
                }
              },
              'volumeMount': {
                'mountPath': '/foo/bar'
              }
            },
            {
              'name': 'my-secret',
              'volume': {
                'secret': {
                  'secretName': 'some-secret',
                  'items': [
                    'key': 'some-key',
                    'path': 'some-path'
                  ]
                }
              },
              'volumeMount': {
                'mountPath': '/var/run/secrets/some-secret'
              }
            }
          ]"

Note

Note that the annotation value itself currently must be provided as JSON.