minikube
DNS
kubernetes
tutorial
networking

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.

Practice system design

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
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track 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.

Practice system design

All Rights Reserved.