apiVersion: apps/v1
kind: Deployment
metadata:
    namespace: dns
    name: unbound
    labels:
        app: unbound
spec:
    replicas: 3
    selector:
        matchLabels:
            role: unbound
    strategy:
        rollingUpdate:
            maxSurge: 1
            maxUnavailable: 2
        type: RollingUpdate
    template:
        metadata:
            labels:
                role: unbound
        spec:
            affinity:
                podAntiAffinity:
                    requiredDuringSchedulingIgnoredDuringExecution:
                    -   labelSelector:
                            matchExpressions:
                            -   key: role
                                operator: In
                                values:
                                -   unbound
                        topologyKey: kubernetes.io/hostname
            containers:
            -   name: unbound
                image: dragoncrafted87/alpine-unbound:edge
                imagePullPolicy: Always
                env:
                -   name: TZ
                    value: America/Chicago
                ports:
                -   containerPort: 53
                    name: dns-tcp
                    protocol: TCP
                -   containerPort: 53
                    name: dns-udp
                    protocol: UDP
                livenessProbe:
                    exec:
                        command: [drill, '@127.0.0.1', cnn.com]
                    timeoutSeconds: 5
                    initialDelaySeconds: 5
                    periodSeconds: 60
                volumeMounts:
                -   name: conf
                    mountPath: /etc/unbound/unbound.conf
                    subPath: unbound.conf
                -   name: domainlist
                    mountPath: /config/domainlist.conf
                    subPath: domainlist.conf
                -   name: hostfilelist
                    mountPath: /config/hostfilelist.conf
                    subPath: hostfilelist.conf
            restartPolicy: Always
            volumes:
            -   name: conf
                configMap:
                    name: unbound-configuration
                    items:
                    -   key: unbound.conf
                        path: unbound.conf
            -   name: domainlist
                configMap:
                    name: unbound-configuration
                    items:
                    -   key: domainlist.conf
                        path: domainlist.conf
            -   name: hostfilelist
                configMap:
                    name: unbound-configuration
                    items:
                    -   key: hostfilelist.conf
                        path: hostfilelist.conf
