Help Center/ Cloud Container Instance/ FAQs/ Network Management FAQs/ How Do I Configure the DNS Service on CCI?
Updated on 2023-06-30 GMT+08:00

How Do I Configure the DNS Service on CCI?

If workloads require the internal domain name resolution provided by Kubernetes, the coredns add-on must be installed. In this case, dnsPolicy of pods must be set to ClusterFirst.

On the Add-on Marketplace page, click on the card of the coredns add-on to install it under the specified namespace.

Figure 1 Installing an add-on

If workloads do not require the internal domain name resolution provided by Kubernetes but require DNS, dnsPolicy of pods must be set to Default.

In addition, you can set dnsPolicy of pods to None to use the custom DNS service. The following is a YAML example:

apiVersion: v1
kind: Pod
metadata:
  namespace: default
  name: dns-example
spec:
  containers:
    - name: test
      image: nginx
  dnsPolicy: "None"
  dnsConfig:
    nameservers:
      - 1.2.3.4
    searches:
      - ns1.svc.cluster-domain.example
      - my.dns.search.suffix
    options:
      - name: ndots
        value: "2"
      - name: edns0