Run minikube, then create a pod (using apiserver's image), then run:
kubectl exec -it test-pod -- sh -c "ping kubernetes"
The output correctly says:
PING kubernetes.default.svc.cluster.local (10.96.0.1) 56(84) bytes of data.
When trying to do the same thing on the api server:
kubectl exec -it kube-apiserver-minikube --namespace kube-system -- /bin/sh -c "ping kubernetes"
We get:
ping: kubernetes: Name or service not known
This happens because the resolv.conf in the apiserver pod is not pointing to the DNS service.
Why is this the case? Admission controllers (webhook servers) don't work if the apiserver can't resolve services.
Run minikube, then create a pod (using apiserver's image), then run:
The output correctly says:
When trying to do the same thing on the api server:
We get:
This happens because the
resolv.confin the apiserver pod is not pointing to the DNS service.Why is this the case? Admission controllers (webhook servers) don't work if the apiserver can't resolve services.