gcloud deployment: unable to change dnsconfig (DNSConfig: custom pod DNS is disabled by feature gate)

11/7/2018

I´m trying to set an additional nameserver for a deployment on gcloud Kubernetes like this:

  dnsConfig:
    nameservers:
    - 172.16.248.32
    searches:
    - ns1.svc.cluster.local
    - mynetwork.local
    options:
    - name: ndots
      value: "2"
    - name: edns0

This fails with the following error:

spec.template.spec.dnsConfig: Forbidden: DNSConfig: custom pod DNS is disabled by feature gate

How can I fix this?

-- Alex Tbk
google-cloud-platform
kubernetes

2 Answers

11/7/2018

Answering own question:

Update to 1.10.9-gke.0 fixed this issue.

Afterwards I spun up an DNS Machine in the cluster with bind9 in order to be able to route cluster.local hostnames inside the cluster and mycompany.local to the company dns.

-- Alex Tbk
Source: StackOverflow

11/7/2018

Just a bit of background on why:

spec.template.spec.dnsConfig: Forbidden: DNSConfig: custom pod DNS is disabled by feature gate

Starting with Kubernetes 1.10 the CustomPodDNS feature became beta and enabled by default. You would have had to add --feature-gates=CustomPodDNS=true to the kube-apiserver and kubelets for this to work on Kubernetes 1.9 and earlier:

header feature gate

-- Rico
Source: StackOverflow