CoreDNS 服务 Corefile 位置

CoreDNS service Corefile location

我想查看CoreDNS服务的配置文件

当我查看 coredns 部署文件时,它显示为

  spec:
  containers:
  - args:
    - -conf
    - /etc/coredns/Corefile
    image: k8s.gcr.io/coredns:1.6.7
    imagePullPolicy: IfNotPresent

Corefile基本上包含在coredns中,是Kubernetes中的一种ConfigMap

  1. 要查看它,您必须检查 ConfigMap 资源。
kubectl get ConfigMap coredns -n kube-system -o yaml

2.If你改了coredns ConfigMap数据Corefile然后/etc/cordns/Corefile会改also.you可以查这个document.

apiVersion: v1
kind: ConfigMap
metadata:
  name: coredns
  namespace: kube-system
data:
  Corefile: |
    .:53 {
        errors
        health {
            lameduck 5s
        }
        ready
        kubernetes cluster.local in-addr.arpa ip6.arpa {
            pods insecure
            fallthrough in-addr.arpa ip6.arpa
            ttl 30
        }
        prometheus :9153
        forward . /etc/resolv.conf
        cache 30
        loop
        reload
        loadbalance
    }