Configure Amazon EKS Auto Mode Clusters for AWS VPC CNI Network Policy Flow Logs
This topic explains how to enable Network Policy event logs on Amazon EKS Auto Mode cluster nodes so that the Illumio cloud operator can collect network flow logs.
Amazon EKS Auto Mode automates Kubernetes cluster management for compute, storage, and networking on AWS.
Collecting the flow logs requires configuring two separate layers:
Cluster-level network policy support
Node-level network policy event logging
Configure Amazon EKS Auto Mode Clusters
Enable the Network Policy Controller.
Create or update the
amazon-vpc-cniConfigMap inkube-system:apiVersion: v1 kind: ConfigMap metadata: name: amazon-vpc-cni namespace: kube-system data: enable-network-policy-controller: "true"
Apply the ConfigMap to enable Network Policy support at the cluster level.
kubectl apply -f enable-network-policy.yaml
This enables Network Policy support at the cluster level.
Caution
Do not use the managed vpc-cni EKS add-on configuration to enable event logging on Amazon EKS Auto Mode. AWS manages the VPC CNI and its Network Policy Agent, which silently ignores settings such as
enableNetworkPolicyEventLogsandenablePolicyEventLogsin the add-on’s Advanced configuration. The agent would continue to reportEnableNetworkPolicyEventLogs: false.To enable event logging, configure both:
The ConfigMap described in Step 1.
The NodeClass described in Step 2.
Enable Network Policy event logs on the NodeClass.
The nodes that produce Network Policy event logs must use a NodeClass containing:
spec: networkPolicyEventLogs: Enabled
If you already use a custom NodeClass, patch the existing one.
kubectl patch nodeclass <your-nodeclass> --type merge \ -p '{"spec":{"networkPolicyEventLogs":"Enabled"}}'Validate the NodeClass
If you use the AWS-managed default NodeClass, create a custom NodeClass.
Important
Do not modify the AWS-managed default NodeClass. Create a custom NodeClass with the same required networking and role settings, and add event logging.
apiVersion: eks.amazonaws.com/v1 kind: NodeClass metadata: name: network-policy-logs spec: role: <node-role> networkPolicyEventLogs: Enabled subnetSelectorTerms: # copy from the existing/default NodeClass securityGroupSelectorTerms: # copy from the existing/default NodeClassCreate or use a custom NodePool that references the new custom NodeClass.
apiVersion: karpenter.sh/v1 kind: NodePool metadata: name: network-policy-logs spec: template: spec: nodeClassRef: group: eks.amazonaws.com kind: NodeClass name: network-policy-logsNew nodes created from that NodePool will use the custom NodeClass configuration.
kubectl get nodeclass <your-nodeclass> -o yaml
Confirm the NodeClass by
networkPolicyEventLogs: Enabled
Verify that event logging is enabled on a node.
List the nodes:
kubectl get nodes
Inspect the Network Policy Agent log for a node:
kubectl get --raw \ "/api/v1/nodes/<node-name>/proxy/logs/aws-routed-eni/network-policy-agent.log" \ | grep NetworkPolicyAgentConfig
The expected output should indicate:
EnableNetworkPolicyEventLogs: true
If it indicates
false, that node does not use a NodeClass with Network Policy event logging enabled.
Logs collected by the operator
The operator collects only the Network Policy Agent log and its rotated generations.
EXAMPLE:
/var/log/aws-routed-eni/network-policy-agent.log /var/log/aws-routed-eni/network-policy-agent-<timestamp>.log /var/log/aws-routed-eni/network-policy-agent-<timestamp>.log.gz