How do I use minikube's DNS?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Minikube is an excellent tool to quickly spin up a local Kubernetes cluster for development and testing. One of its features is a lightweight DNS server that helps resolve service names within the cluster. This article will take you through how to use Minikube's DNS, providing technical explanations and examples when necessary. We'll also cover additional subtleties in DNS usage within Minikube to provide a better understanding for your development workflows.
Understanding DNS in Kubernetes
In Kubernetes, DNS is crucial for service discovery, enabling services to find each other using symbolic names rather than static IP addresses. Kubernetes automatically configures DNS to resolve services operating under specific namespaces by assigning them fully qualified domain names (FQDNs). External or intra-cluster services can be accessed using these FQDNs.
Setting Up Minikube
Before diving into DNS specifics, ensure you have Minikube installed. You can verify installation and start a Kubernetes cluster with the following commands:
- name: nginx
- containerPort: 80
- protocol: TCP
- Service name only: Resolves to the service in the same namespace.
- service-name.namespace.svc: Resolves the service in a specific namespace.
- service-name.namespace.svc.cluster.local: Fully qualified call with all details.
- Verify that the `kube-dns` or `CoreDNS` pods are running without issues: `kubectl get pods -n kube-system`.
- Check configurations in `/etc/resolv.conf` within pods.
- Inspect logs of CoreDNS for errors: `kubectl logs -n kube-system coredns-xxxxx`.
- Ensure that network policies or firewall rules don’t block DNS ports.
Related reading
- How do we install dynamic modules non support officially on Nginx Ingress Controller? terraform, helm chart
- How do you add multiple config files to configMap with kustomize configMapGenerator by using a pattern/regex/...?
- How do you cleanly list all the containers in a kubernetes pod?
- How do you delete Minikube hostpath directory from host using xhyve?
- How do I use WebRequest to access an SSL encrypted site using HTTPS?
- How do raft nodes learn about peers?
- How do you enable Feature Gates in K8s?
- How do you find the cluster service CIDR of a Kubernetes cluster?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.