apiVersion: apps/v1
kind: Deployment
metadata:
  name: netmaker-dns
  labels:
    app: netmaker-dns
spec:
  selector:
    matchLabels:
      app: netmaker-dns
  replicas: 1
  template:
    metadata:
      labels:
        app: netmaker-dns
    spec:
      containers:
      - args:
        - -conf
        - /root/dnsconfig/Corefile
        image: coredns/coredns
        imagePullPolicy: Always
        name: netmaker-dns
        ports:
        - containerPort: 53
          name: dns
          protocol: UDP
        - containerPort: 53
          name: dns-tcp
          protocol: TCP
        volumeMounts:
        - mountPath: /root/dnsconfig
          name: nm-pvc
          readOnly: true
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            add:
            - NET_BIND_SERVICE
            drop:
            - all
      dnsPolicy: "None"
      dnsConfig:
        nameservers:
          - 127.0.0.1
      volumes:
      - name: nm-pvc
        persistentVolumeClaim:
          claimName: nm-pvc
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: netmaker-dns
  name: netmaker-dns
spec:
  ports:
  - port: 53
    protocol: UDP
    targetPort: 53
    name: udp
  - port: 53
    protocol: TCP
    targetPort: 53
    name: tcp
  selector:
    app: netmaker-dns
  sessionAffinity: None
  type: ClusterIP
  clusterIP: 10.152.183.53
