- External traffic entering the cluster and reaching the ingress/Gateway service (LoadBalancer or NodePort).
- Traffic flowing from the ingress/Gateway proxy to backend pods inside the cluster.
When designing policies, consider both the traffic source (external clients vs. the ingress/Gateway identity) and the intended targets (ingress controller pods vs. backend application pods). Scoping policies to specific pod labels is safer than using broad selectors like empty endpointSelector or global entities.
Enforcement points at a glance
| Enforcement point | What to allow | Typical Cilium object |
|---|---|---|
| Outside → Ingress/Gateway | Allow external world to reach ingress controller Service/Pods | CiliumClusterwideNetworkPolicy scoped to ingress labels |
| Ingress/Gateway → Backend pods | Allow ingress/Gateway proxy identity to reach backend pods | CiliumNetworkPolicy or CiliumClusterwideNetworkPolicy allowing reserved:ingress or ingress pod labels |
1) Allow external traffic into the cluster (to your ingress/Gateway)
If you have cluster-wide network restrictions in Cilium, external clients may be prevented from reaching your ingress Service (LoadBalancer/NodePort). A permissive cluster-wide policy that allows traffic from the outside world looks like this:- endpointSelector: matches all endpoints in the cluster — this is very permissive and not recommended for production.
- Instead, scope the policy to only the ingress/Gateway pods using a label selector (recommended). For example, if your ingress pods use label app: ingress-controller:
2) Allowing ingress/Gateway to talk to backend pods
Ingress and Gateway API implementations are represented inside Cilium by a reserved identity. Cilium exposes the reserved:ingress identity for traffic originating from the ingress/Gateway proxy. Backend pods must permit traffic from that identity (or from the ingress pod labels) so the proxy can reach application endpoints. A cluster-wide policy that allows egress from the reserved ingress identity into the cluster:- The endpointSelector selects endpoints that carry the reserved:ingress identity (this identifies the ingress/Gateway proxy within Cilium).
- The egress rule sends traffic to the entity cluster (all cluster endpoints). For tighter security, replace toEntities: cluster with endpointSelector-based destinations that match only your backend pods.
Use label-based selectors for least-privilege access. Entity-based allowances like world or cluster are useful for testing, but for production prefer policies that target specific ingress pod labels or backend labels to limit blast radius.
Practical recommendations
- Prefer CiliumClusterwideNetworkPolicy scoped to ingress labels for allowing external traffic into ingress Services.
- Use reserved:ingress identity or ingress pod label selectors to permit the proxy to reach backend pods.
- Avoid global endpointSelector: or broad entity allowances (world, cluster) unless you intentionally want cluster-wide access.
- Test policies incrementally: first allow connectivity, then tighten selectors to application-specific labels.
Summary
- Two enforcement points when using ingress/Gateway API: (1) outside → ingress and (2) ingress → backend.
- Allow external traffic to reach the ingress Service, but scope that access to ingress pods via labels when possible.
- Allow the reserved ingress identity (reserved:ingress) or ingress pod labels to reach backend pods; ensure backend policies explicitly permit that traffic.
- Follow least-privilege practices: prefer label-based selectors and narrow rules in production.
Links and references
- Gateway API
- Cilium Gateway API docs
- Cilium documentation
- Cilium policy language
- Cilium reserved identities