Posts

Showing posts from July, 2025

🔍 Ever Wonder How Pods in a Kubernetes Cluster Seamlessly Communicate via DNS?

How Internal DNS Works in Kubernetes (And How to Add Custom Records with CoreDNS) Ever Wonder How Pods in a Kubernetes Cluster Seamlessly Communicate via DNS? When working with Kubernetes, one of the most magical experiences is watching how pods and services can easily discover and talk to each other — often with just a name like my-service.default.svc.cluster.local . But behind this simplicity is a powerful and flexible system built into Kubernetes: CoreDNS . 📦 What is CoreDNS? CoreDNS is the default DNS server for Kubernetes clusters. It acts as a DNS server that runs inside the cluster and handles service discovery. Instead of hardcoding IPs or deploying your own DNS infrastructure, CoreDNS dynamically registers and resolves names based on the Kubernetes API. Key Responsibilities of CoreDNS: Resolving internal service names to ClusterIP addresses Allowing pods in one namespace to discover services in another Forwar...

🔍 Why You Only See a Private IP Inside an AWS EC2 Instance — Even If It Has a Public IP

Why You Only See a Private IP Inside an AWS EC2 Instance 🤔 The Mystery: Where Did My Public IP Go? Let’s say you’ve just launched an EC2 instance in AWS. You assign it a public IP address like 54.201.112.34 , and you successfully SSH into it: ssh ec2-user@54.201.112.34 Once inside, you run: ip addr But instead of seeing the public IP, you get something like: inet 10.0.1.42/24 brd 10.0.1.255 scope global eth0 So… where’s the public IP? 🧠 What’s Actually Happening Behind the Scenes Every EC2 instance gets a private IP from the VPC subnet. If you assign a public IP (or Elastic IP), AWS performs a 1:1 NAT mapping externally — not inside the instance. The OS inside the instance never sees the public IP. TL;DR: The public IP is mapped outside the instance by AWS NAT. The instance is only aware of its private IP. 🌐 Visual Flow (Conceptual) YOU (Public Internet) | | Connects to Public IP: 54.201.112.34 | [ AWS NAT Gateway ] | Tra...