Day 31/40 - Understanding CoreDNS In Kubernetes

About this video

### Summary of the Video Content: 1. **Introduction and Context**: - The video is part of a series (video #31) focusing on Kubernetes (referred to as "Cubanities" in the text). - It covers **CoreDNS concepts** and how DNS works in Kubernetes. - Viewers unfamiliar with DNS are encouraged to watch the previous video (#30) for foundational knowledge. 2. **Objective of the Video**: - To explain how DNS resolution works in Kubernetes, particularly for service-to-service communication. - The target for engagement is 100 likes and 100 comments. 3. **Demonstration Setup**: - Two pods (`EngineXpod` and `EngineX1pod`) are deployed in the default namespace using the same image (`EngineX`). - These pods are exposed via services (`EngineX` and `EngineX1`), which should allow communication between them using service names. 4. **DNS Issue Demonstration**: - A connectivity test shows that while curling the service name (`EngineX1`) fails, curling its IP address succeeds. - This indicates a **DNS misconfiguration**, as the service name cannot be resolved to its IP address. 5. **CoreDNS Role in Kubernetes**: - CoreDNS is the DNS server in Kubernetes, responsible for resolving service names to IP addresses. - The issue arises because the CoreDNS pods were scaled down to 0 replicas, causing DNS resolution to fail. - Scaling CoreDNS back to 2 replicas resolves the issue, allowing service name resolution. 6. **CoreDNS Deployment Details**: - CoreDNS runs as a deployment in the `kube-system` namespace. - It exposes a service named `kube-dns` on port 53, which is used for internal DNS resolution. - Every pod in the cluster has an `/etc/resolv.conf` file pointing to the CoreDNS service IP (`10.96.0.10`). 7. **Configuration of CoreDNS**: - CoreDNS uses a **ConfigMap** to manage its configuration. - Key plugins in the Corefile include: - `errors`: Redirects errors to STDERR. - `health`: Performs health checks. - `ready`: Indicates readiness. - `kubernetes`: Handles DNS queries for Kubernetes services. - `prometheus`: Exposes metrics on port 9153. - `forward`: Forwards unresolved queries to upstream DNS servers. 8. **Local DNS Resolution**: - Pods use `/etc/resolv.conf` for DNS resolution, which includes: - A `nameserver` entry pointing to the CoreDNS service IP. - Search domains like `cluster.local` for resolving service names. - Without CoreDNS, manual entries in `/etc/hosts` would be required, which is impractical at scale. 9. **Troubleshooting CoreDNS**: - If CoreDNS pods fail to start, check the **networking add-on** (e.g., Calico) installation. - On AWS EC2, ensure the **source/destination check** is disabled for instances. - Verify that **IP auto-detection** is enabled for the Calico node DaemonSet. 10. **Next Steps and Upcoming Content**: - Viewers are encouraged to explore DNS tasks in the Kubernetes documentation. - The next video (#32) will cover Kubernetes networking concepts, including CNI plugins, container runtimes, and more. - An experienced guest speaker will provide detailed insights into these topics. 11. **Conclusion**: - CoreDNS is essential for DNS resolution in Kubernetes, enabling seamless service-to-service communication. - Proper configuration and troubleshooting of CoreDNS and networking components are critical for cluster functionality. - The video concludes with a call to engage, guess the guest speaker's name, and stay tuned for future content. --- This summary captures the key points and flow of the video, focusing on DNS concepts, CoreDNS functionality, and troubleshooting steps.


Course: Certified Kubernetes Administrator Full Course For beginners | CKA 2025

This playlist contains the complete CKA series for beginners, based on the latest 2025 curriculum. It includes 40+ videos with hands-on demos, assignments, and exam-based scenarios. We will cover everything from the basics to the Advanced, including fundamental concepts such as Docker, containers, Docker storage and networking, DNS, etc.

View Full Course