Configure Kubernetes

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

The Deployment Template section of your Deployment provides a kubernetes attribute that allows you to specify Kubernetes-specific options for your Deployment.

Currently, you can specify these options for pods created for Flink jobs.

kind: Deployment
spec:
  template:
    spec:
      kubernetes:
        pods:
          annotations:
            key: value
          nodeSelector:
            key: value
          affinity:
            KubernetesAffinity
          tolerations:
            - KubernetesToleration
          volumeMounts:
            - name: name
              volume: KubernetesVolume
              volumeMount: KubernetesVolumeMount

Annotations

You can attach annotations to pods created for Flink jobs via pods.annotations.

kind: Deployment
  spec:
    template:
      spec:
        kubernetes:
          pods:
            annotations:
              key: value

Provided annotations will be added to the metadata section of created pods.

Node Selector

You can attach a node selector to pods created for Flink jobs in order to constrain pods to run on particular nodes via pods.nodeSelector.

kind: Deployment
  spec:
    template:
      spec:
        kubernetes:
          pods:
            nodeSelector:
              key: value

Affinity

You can attach an affinity to pods created for Flink jobs in order to constrain pods to run on particular nodes via pods.affinity.

kind: Deployment
  spec:
    template:
      spec:
        kubernetes:
          pods:
            affinity:
              KubernetesAffinity

KubernetesAffinity is expected to be of type Affinity. The provided affinity will only be validated when the actual job is created and not when creating/modifying the resource.

Tolerations

You can attach tolerations to pods created for Flink jobs in order ensure that pods are not scheduled onto inappropriate nodes via pods.tolerations.

kind: Deployment
  spec:
    template:
      spec:
        kubernetes:
          pods:
            tolerations:
              - KubernetesToleration

KubernetesToleration is expected to be of type Toleration. The provided tolerations will only be validated when the actual job is created and not when creating/modifying the resource.

Volume Mounts

You can attach volumes and volume mounts to pods created for Flink jobs, for instance an NFS mount for use as a state backend via pods.volumeMounts.

kind: Deployment
  spec:
    template:
      spec:
        kubernetes:
          pods:
            volumeMounts:
              - name: name
                volume: KubernetesVolume
                volumeMount: KubernetesVolumeMount

KubernetesVolume is expected to be of type Volume and KubernetesVolumeMount is expected to be of type VolumeMount. The provided volumes and volume mounts will only be validated when the actual job is created and not when creating/modifying the resource.

Example: Mounting an NFS and Secret

kind: Deployment
spec:
  template:
    spec:
      kubernetes:
        pods:
          volumeMounts:
            - name: my-volume
              volume:
                nfs:
                  server: 10.1.2.3
                  path: /daplatform-foo
              volumeMount:
                mountPath: /foo/bar
            - name: my-secret
              volume:
                secret:
                  secretName: my-secret
              volumeMount:
                mountPath: /var/run/secrets/some-secret