How to change ndots option default value of dns in Kubernetes

Viewed 1745

I want to change ndots default value from 5 to 3 in all pods in Kubernetes. for example, this is the current resolv.conf output from one of my pods. How can I change the value of ndots from 5 to 3 in all current and future pods:

[root@master01 ~]# kubectl exec test-7c9b9bc678-kfcsj -- cat /etc/resolv.conf 
nameserver 10.96.0.10
search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5

Kubernetes version: 1.18. Install on bare metal servers. Thank you in advanced

1 Answers

You can adjust this configuration in the pod's dnsConfig section. See more details here.

We are doing the same in the helm chart responsible for deploying applications into our cluster, like so -

dnsConfig:
  options:
    - name: ndots
      value: "3"
Related