CoreDNS 服务 Corefile 位置

Siv*_*arj 5 dns kubernetes coredns

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

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

  spec:
  containers:
  - args:
    - -conf
    - /etc/coredns/Corefile
    image: k8s.gcr.io/coredns:1.6.7
    imagePullPolicy: IfNotPresent
Run Code Online (Sandbox Code Playgroud)
  • /etc/coredns/Corefile 是容器内的吗
  • 如果是,如何查看它..我无法进入 coredns 容器
  • 如果我更改 coredns 配置映射文件,/etc/coredns/Corefile 也会更改

核心豆荚

无法进入 coredns pod

Tay*_*man 3

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

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

Run Code Online (Sandbox Code Playgroud)

2.如果你改变了 coredns ConfigMap 数据 Corefile 那么 /etc/cordns/Corefile 也会被改变。你可以查看这个文档

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
    }
Run Code Online (Sandbox Code Playgroud)