☸️ CoreDNS and AWS VPC CNI in EKS

CoreDNS vs AWS VPC CNI in EKS: What Each Component Actually Does

When working with Amazon EKS, two important components help your Kubernetes cluster communicate properly: CoreDNS and AWS VPC CNI.

Both are part of the networking story, but they do very different jobs. CoreDNS helps pods find services by name, while AWS VPC CNI gives pods network connectivity using IP addresses from your AWS VPC.

In simple words:

  • CoreDNS answers: “What IP address belongs to this service name?”
  • AWS VPC CNI answers: “How does traffic reach that pod over the network?”

1. What is CoreDNS?

CoreDNS is the DNS server used inside Kubernetes. Its main job is to resolve Kubernetes service names into IP addresses.

For example, if one pod wants to call another service using a name like:

user-service.default.svc.cluster.local

CoreDNS resolves that service name into the correct Kubernetes service IP.

What CoreDNS Does

  • Resolves Kubernetes service names
  • Supports pod-to-service communication
  • Helps with internal service discovery
  • Forwards external DNS queries to upstream DNS resolvers

Simple CoreDNS Flow

Pod → CoreDNS → Service IP → kube-proxy → Target Pod

Step by step:

  1. A pod sends a request using a Kubernetes service name.
  2. CoreDNS resolves the service name into a ClusterIP.
  3. Kubernetes routes the traffic to the correct backend pod.

Important Note About CoreDNS

CoreDNS is mainly used for internal cluster DNS resolution. If traffic comes from the internet through an ALB or Ingress, CoreDNS is usually not part of the first external request flow.

Example external flow:

Internet → ALB → Ingress → Service → Pod

In this flow, the public request is handled by the ALB and Ingress first. CoreDNS becomes important when a pod inside the cluster needs to call another internal service by name.


2. What is AWS VPC CNI?

AWS VPC CNI is the networking plugin used by Amazon EKS. It is responsible for giving pods IP addresses from your AWS VPC subnets.

This is one of the key differences in EKS networking. In many Kubernetes environments, pod networking may use an overlay network. In EKS with AWS VPC CNI, pods receive real VPC IP addresses.

What AWS VPC CNI Does

  • Assigns IP addresses to pods
  • Uses AWS VPC subnets for pod networking
  • Connects pod traffic to AWS networking
  • Allows pod-to-pod communication through the VPC network
  • Uses Elastic Network Interfaces, also called ENIs, on worker nodes

Example pod IPs:

Pod A IP: 10.0.1.25
Pod B IP: 10.0.2.18

These IPs come from the VPC subnet, not from a separate overlay network.

Simple AWS VPC CNI Flow

Pod → Node ENI → VPC network → Target Pod

The AWS VPC CNI allows pod traffic to move through AWS networking using real pod IPs.


3. How CoreDNS and AWS VPC CNI Work Together

CoreDNS and AWS VPC CNI work together during internal service communication.

Let us say order-service needs to call user-service.

order-service Pod → CoreDNS → user-service IP → kube-proxy → VPC CNI network → user-service Pod

Step by step:

  1. The order-service pod sends a request using the user-service name.
  2. CoreDNS resolves the user-service name into a Kubernetes service IP.
  3. kube-proxy helps route the request to one of the backend pods.
  4. AWS VPC CNI handles the actual pod networking path through the VPC.
  5. The request reaches the target user-service pod.

4. Easy Difference to Remember

Component Main Purpose Simple Meaning
CoreDNS Resolves service names to IP addresses Finds where the service is
AWS VPC CNI Provides pod networking using VPC IPs Moves traffic through the network

5. Common Issues and Debugging

This is where understanding CoreDNS and AWS VPC CNI becomes very useful. Many EKS issues look like application issues, but the real problem may be DNS resolution or pod networking.

CoreDNS Issue Example

If CoreDNS is unhealthy or overloaded, pods may fail to resolve service names. You may see errors like:

Temporary failure in name resolution
nslookup: connection timed out
no such host

Useful commands to check CoreDNS:

kubectl get pods -n kube-system | grep coredns

kubectl logs -n kube-system -l k8s-app=kube-dns

kubectl describe deployment coredns -n kube-system

AWS VPC CNI Issue Example

If AWS VPC CNI has issues, pods may fail to get IP addresses or may not communicate correctly.

Common causes include:

  • Subnet IP exhaustion
  • ENI limits reached on worker nodes
  • aws-node DaemonSet problems
  • Security group or network ACL restrictions

Useful commands to check AWS VPC CNI:

kubectl get pods -n kube-system | grep aws-node

kubectl logs -n kube-system -l k8s-app=aws-node

kubectl describe daemonset aws-node -n kube-system

Pod Pending Due to IP Issues

If a pod is stuck in Pending, one possible reason is that the node or subnet does not have enough available IP addresses.

Check the pod events:

kubectl describe pod <pod-name> -n <namespace>

Look for messages related to IP assignment or CNI failures.


6. Real Production Example

In real production environments, you may see application errors like:

context deadline exceeded

This usually means the request did not complete before the timeout. The root cause could be at the application level, but it can also be related to infrastructure issues.

In an EKS environment, this type of error may be connected to:

  • Slow DNS resolution from CoreDNS
  • Network path issues between pods
  • Pod or service endpoint problems
  • AWS VPC CNI networking issues
  • Target service being overloaded or unavailable

That is why it is important to check both DNS and networking while debugging EKS service communication issues.


7. Quick Troubleshooting Table

Problem Possible Area What to Check
Service name does not resolve CoreDNS CoreDNS pods and logs
Pod cannot connect to another pod VPC CNI / Network aws-node logs, security groups, routes
Pod stuck in Pending VPC CNI / IP capacity Pod events, subnet IP availability
context deadline exceeded DNS / Network / App CoreDNS logs, service endpoints, target pod health

8. Frequently Asked Questions

Does CoreDNS handle external traffic?

No. CoreDNS mainly handles DNS resolution inside the Kubernetes cluster. For external traffic, components like ALB, Ingress, services, and pods are usually involved first.

Does AWS VPC CNI assign real VPC IPs to pods?

Yes. In Amazon EKS, AWS VPC CNI assigns pod IP addresses from your AWS VPC subnets.

Can CoreDNS cause application timeouts?

Yes, sometimes. If DNS resolution is slow or failing, an application may not be able to reach another service in time. But timeout errors can also come from application performance, service overload, network issues, or target pod problems.

Can AWS VPC CNI cause pods to stay Pending?

Yes. If there are not enough available IP addresses in the subnet, or if ENI limits are reached, new pods may fail to get IP addresses and remain Pending.


9. Final Thought

If you are learning Amazon EKS, understanding CoreDNS and AWS VPC CNI is a great starting point.

CoreDNS helps pods find services by name. AWS VPC CNI helps pods communicate over the AWS network.

Together, they make internal communication inside EKS possible. When debugging EKS issues, always remember to check both:

  • DNS resolution through CoreDNS
  • Pod networking through AWS VPC CNI

Many production issues that look like application failures can actually be DNS or networking problems underneath.

Popular posts from this blog

☁️ AWS Global Accelerator (GA) + Route 53

🐳 Docker Filesystem Internals (AdvancEd)

Understanding RabbitMQ Classic Mirrored Queues and Quorum Queues

🐳 Docker Tutorial for Beginners: Step-by-Step with a Simple Example

☸️What’s Inside EKS? A Beginner’s Guide to Its Core Components

☸️ Kubernetes Taints and Tolerations(with Node Affinity)

AWS Load Balancer Controller Upgrade Guide: v2.x to v3.3

🐳 Build a Tiny Flask Web App in Docker (with Ports)

☁️ Amazon S3 Explained: More Than Just Object Storage