Skip to content

CoreDNS ​

After installing the CNI for networking, we need to install CoreDNS.

The purpose of CoreDNS in Kubernetes is to provide DNS (Domain Name System) resolution for services and pods within the cluster.
It allows pods to discover and communicate with each other using DNS names instead of relying on IP addresses, which can change dynamically.

Installation ​

The installation of CoreDNS requires the Helm chart located at https://coredns.github.io/helm.

Here is the minimal installation.

INFO

The clusterIP should match the clusterIP define during the k3s installation. By default the clusterIP is 10.43.0.10.

yaml
coredns:
  service:
    # -- This IP should match the one provided by k3s with the option --cluster-dns
    # By default, the value is 10.43.0.10
    clusterIP: 10.43.0.10
  servers:
    - zones:
      - zone: .
      port: 53
      plugins:
      - name: errors
      - name: health
        configBlock: |-
          lameduck 5s
      - name: ready
      - name: kubernetes
        parameters: cluster.local in-addr.arpa ip6.arpa
        configBlock: |-
          pods insecure
          fallthrough in-addr.arpa ip6.arpa
          ttl 30
        # -- @default
        # - name: forward
        #   parameters: . /etc/resolv.conf
      - name: forward
        # By default, CoreDNS watches the resolv.conf file inside your Kubernetes nodes for DNS resolution. 
        # Since I use Pi-hole as my DNS server, I modify this parameter to specify the IP addresses of my Pi-hole servers. 
        parameters: . 192.168.1.3 192.168.1.4
      - name: cache
        parameters: 30
      - name: loop
      - name: reload
      - name: loadbalance

And voila !

Released under the MIT License.