Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow adding configuration to coredns .:53 block via *.override keys in coredns-custom ConfigMap #7639

Closed
brandond opened this issue May 31, 2023 · 4 comments
Assignees
Milestone

Comments

@brandond
Copy link
Member

brandond commented May 31, 2023

From @andrewroffey

Allow CoreDNS override extensions in default Corefile

Other K8s implementations such as AKS[1] and DigitalOcean[2] have similar configuration:
1: https://learn.microsoft.com/en-us/azure/aks/coredns-custom
2: https://docs.digitalocean.com/products/kubernetes/how-to/customize-coredns/

This would enable ConfigMaps to adjust the CoreDNS settings without creating a whole copy of coredns.yaml.

@aganesh-suse
Copy link

aganesh-suse commented Jun 15, 2023

k3s commit: b66a118

kubectl get configmaps --namespace=kube-system coredns -o yaml

shows .:53 having:

import /etc/coredns/custom/*.override
k apply -f custom.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: coredns-custom
  namespace: kube-system
data:
  log.override: |
    log
  custom.server: |
    why.local {
      forward . 127.0.0.1
    }
k delete pod coredns-77ccd57875-l7fnq -n kube-system
k get pods -A 
NAME                                     READY   STATUS             RESTARTS   AGE
coredns-77ccd57875-l7fnq                 1/1     Running            0          4s
helm-install-apache-q6hgj                0/1     Completed          0          141m
helm-install-traefik-6jcqb               0/1     Completed          1          121m
helm-install-traefik-crd-jglnf           0/1     Completed          0          152m
local-path-provisioner-957fdf8bc-2c94g   1/1     Running            0          152m
metrics-server-648b5df564-qfb24          1/1     Running            0          152m
svclb-traefik-429dbe72-4424p             2/2     Running            0          120m
svclb-traefik-429dbe72-6kbzs             2/2     Running            0          120m
svclb-traefik-429dbe72-8nhs8             2/2     Running            0          120m
svclb-traefik-429dbe72-pc764             2/2     Running            0          120m

kubectl describe pod coredns-77ccd57875-l7fnq -n kube-system

shows:

Volumes:
  config-volume:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      coredns
    Optional:  false
  custom-config-volume:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      coredns-custom
    Optional:  true
kubectl get configmaps --namespace=kube-system coredns-custom -o yaml

displays the updated config from above ^^

k -n kube-system logs pod/coredns-77ccd57875-l7fnq
.:53
why.local.:53
[INFO] plugin/reload: Running configuration SHA512 = 2e241110619e8c5ec252af702135deed1c90a4dab89bd410554347468d0c1d064fd0571098262fc611b97ef366f864627bb1c309b078c2dca755f55aae118364
CoreDNS-1.10.1
linux/amd64, go1.20, 055b2c3
[INFO] 127.0.0.1:50386 - 25704 "HINFO IN 735618883049447441.6322315480693977090. udp 56 false 512" NXDOMAIN qr,rd,ra 131 0.019542746s

@gfrankliu
Copy link

I hope the logs won't be filled with warnings when people aren't using this feature and the .override doesn't exist. Currently we have this issue with .server in the configmap:

kubectl -n kube-system logs coredns-59b4f5bbd5-4shsp
...
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server

@gfrankliu
Copy link

I just installed the latest k3s and confirmed this feature adds more warning in the log. Every 30 seconds, below two lines are added in coredns log:

[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.override
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server

@brandond Can this be fixed?

@brandond
Copy link
Member Author

brandond commented Jun 30, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants