Configure ARTESCA without DNS Enabled

Introduction

The Kubernetes cluster has its own DNS service that is used to resolve service names to IP addresses within the cluster. This DNS service also forwards DNS queries to the nameservers configured on the host machine to resolve names of external services like NTP, SMTP, etc. This feature is enabled by default.

This section explains how to disable the DNS forwarding feature in the Kubernetes cluster. This is useful when the host machine is not connected to the Internet or when the DNS servers are not reachable. In such cases, the DNS forwarding feature can cause delays in resolving the names of external services.

To disable this feature during the deployment, you can add the option --no-dns-host-forward during the configuration file generation. Refer to Installer Configuration for more information.

Procedure

On the bootstrap node

  1. Export the MetalK8s version you are using as an environment variable:

    [artesca-os@bootstrap ~]$
    
    export MK8SVERSION=`sudo kubectl \
        --kubeconfig=/etc/kubernetes/admin.conf \
        get cm -n kube-system artesca-version \
        -o jsonpath="{.data.metalk8s}"`
    
  2. Edit the /etc/metalk8s/bootstrap.yaml file to disable the DNS forwarding feature by setting the hostForward parameter to False:

    [artesca-os@bootstrap ~]$
    
    sudo salt-call --local state.single file.serialize \
        /etc/metalk8s/bootstrap.yaml merge_if_exists=True \
        dataset='{"kubernetes": {"coreDNS": {"hostForward": False}}}'
    
  3. Apply the changes:

    [artesca-os@bootstrap ~]$
    
    sudo kubectl exec --kubeconfig /etc/kubernetes/admin.conf \
        $(sudo kubectl --kubeconfig /etc/kubernetes/admin.conf \
        get pod -n kube-system -l app=salt-master -o name) \
        -n kube-system -c salt-master -- \
        salt-run state.sls metalk8s.kubernetes.coredns.deployed \
        saltenv=metalk8s-$MK8SVERSION
    

On all nodes

  1. Remove all the DNS servers using nmtui or nmcli.

  2. Remove any dns=none in /etc/NetworkManager/NetworkManager.conf.

    Also make sure that the hostname is flat, not in a Fully Qualified Domain Name (FQDN) format.

  3. Restart the NetworkManager service. Replace <NODE_NAME> with the name of

    the node where you are running the command:

    [artesca-os@<NODE_NAME> ~]$
    
    sudo systemctl restart NetworkManager
    
  4. Ensure /etc/resolv.conf is empty.

    Important

    Do not edit this file manually, as it is managed by the NetworkManager service.