How to disable Kube-DNS on GKE

6/17/2021

I have a CoreDNS running in our cluster that uses the Kube DNS service. I want to disable the AutoScaler and the Kube-DNS deployment or scale it to 0.

As soon as I do this, however, it is always automatically scaled up to 2. What can I do?

-- n00dle
google-kubernetes-engine
kube-dns
kubernetes

1 Answer

6/22/2021

The scenario you are going through is described by the official documentation.

  • Make sure that you created your custom CoreDNS as described here.

  • Disable the kube-dns managed by GKE by scaling the kube-dns Deployment and autoscaler to zero using the following command:


kubectl scale deployment --replicas=0 kube-dns-autoscaler --namespace=kube-system
kubectl scale deployment --replicas=0 kube-dns --namespace=kube-system

  • If the above command will still not work than try the following one:

kubectl scale --replicas=0 deployment/kube-dns-autoscaler --namespace=kube-system 

kubectl scale --replicas=0 deployment/kube-dns --namespace=kube-system

Remember to specify the namespace.

-- WytrzymaƂy Wiktor
Source: StackOverflow