https://rancher.com/ logo
#general
Title
# general
a

adamant-kite-43734

02/17/2023, 10:25 AM
This message was deleted.
l

loud-eve-73457

02/17/2023, 10:51 AM
I am trying to add something to coredns corefile with rke2 helmchartconfig. However, any addition to the original corefile leads to a incorrect result.
a

astonishing-rose-49461

03/03/2023, 4:54 AM
@loud-eve-73457 did you ever come up with a solution for this? I’m running into a similar issue.
l

loud-eve-73457

03/03/2023, 5:57 AM
@astonishing-rose-49461 yep. I figured it out. the only way is to use zoneFiles which will attach a config file to provide more dns setting like below.
Copy code
apiVersion: <http://helm.cattle.io/v1|helm.cattle.io/v1>
kind: HelmChartConfig
metadata:
  name: rke2-coredns
  namespace: kube-system
spec:
  valuesContent: |-
    zoneFiles:
      - filename: xxx.tech.conf
        domain: xxx.tech
        contents: |
          xxx.tech:53 {
              errors
              cache 30
              forward . 10.0.254.1
          }
    extraConfig:
      import:
        parameters: /etc/coredns/xxx.tech.conf
maybe you should also put the original k8s dns setting above it, and the final setting will be like (watch out the ‘import’ line, it contains the additional zone servers):
Copy code
kubectl -n kube-system get configmap rke2-coredns-rke2-coredns -o go-template={{.data.Corefile}}
---
import /etc/coredns/xxx.tech.conf
.:53 {
    errors
    health  {
        lameduck 5s
    }
    ready
    kubernetes   xxx.local  xxx.local cluster.local in-addr.arpa ip6.arpa {
        pods insecure
        fallthrough in-addr.arpa ip6.arpa
        ttl 30
    }
    prometheus   0.0.0.0:9153
    forward   . /etc/resolv.conf
    cache   30
    loop
    reload
    loadbalance
283 Views