aws / aws/amazon-network-policy-controller-k8s

Network Policy Rule Evaluation Blocks Traffic to DNS Server

Open
#146 10 comments 3 reactions 1 assignee Claimed by @jaydeokar View on GitHub
bug
Dominant language
Go
Stars
54
Forks
28
PR merge metrics
No merged PRs in 30d

Description

**What happened**:
I created a new EKS clusters and enabled network policy in the VPC-CNI, but I realized the following `NetworkPolicy` blocks the dns resolution requests. It was working when I used Calico as the network plugin.

```
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: curl
namespace: default
spec:
egress:
- to:
- ipBlock:
cidr: 0.0.0.0/0
except:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
- ports:
- protocol: UDP
port: 53
- port: 53
protocol: TCP
policyTypes:
- Egress
podSelector:
matchLabels:
app: curl
```

**Attach logs**

**What you expected to happen**:
The first rule would block DNS requests to kube-dns (172.20.0.10 in our case), but the second rule should allow the request.

**How to reproduce it (as minimally and precisely as possible)**:
Create a pod with label `app: curl` in the default namespace as the NetworkPolicy on an EKS cluster with network policy enabled in VPC-CNI. I attached this config to the EKS addon `{ "enableNetworkPolicy": "true" }`.

**Anything else we need to know?**:

**Environment**:
- Kubernetes version (use `kubectl version`): `Client Version: v1.31.1, Server Version: v1.30.5-eks-ce1d5eb`
- CNI Version: v1.18.1-eksbuild.3
- OS (e.g: `cat /etc/os-release`): Linux Bottlerocket OS 1.22.0 (aws-k8s-1.30)
- Kernel (e.g. `uname -a`):

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.