Network policies¶
Every application's namespace starts closed: its pods may resolve names (CoreDNS) and nothing else, neither
receive a connection nor open one, to another namespace, to the cluster's own services or to the Internet. Each
application then allows exactly what it needs with its own CiliumNetworkPolicy.
The defaults (inventory/group_vars/k8s/policies.yml)¶
Two Cilium cluster-wide policies (CiliumClusterwideNetworkPolicy): they cover every namespace, those created
later too, without generating anything per namespace (no admission controller, no Kyverno).
ethere-default-deny: selects the pods of every namespace but the system ones (k8s_policies_exempt_namespaces:kube-system,dns,cert-manager) and those labelledethe.re/default-deny: "false"(pods only: Cilium's reserved identities, such as the Gateway's Envoy,reserved:ingress, aren't selected); ingress and egress in default deny (enableDefaultDeny, and an empty ingress rule: Cilium enforces a direction only when a policy has a rule for it), egress allowed to CoreDNS only, through Cilium's DNS proxy (rules: dns): the names a pod resolves are known to Cilium, which the applications'toFQDNsrules need (Cilium'sl7Proxy, in the agent).ethere-deny-metadata: the OpenStack metadata service (169.254.169.254, reached through NAT64 as64:ff9b::a9fe:a9fe) denied to every pod, system ones included: a deny rule, which no allow lifts. The nodes drop what they forward to it too (nftables,k8s_node/services.yml); their own processes and host network pods still reach it (the Cinder CSI node plugin,docs/admin/volumes.md).
They are applied by the control plane at boot once Cilium's operator registered their kind
(ethere-policies.service, k8s_ctrl/services.yml).
Allowing an application¶
For the applications: docs/network.md, served by the cluster (docs/admin/documentation.md): a
CiliumNetworkPolicy per flow (fromEntities: [ingress] for the Gateway, toFQDNs, toEntities: [kube-apiserver],
toEntities: [world]). A namespace may opt out of the defaults with the label ethe.re/default-deny: "false": for
tools, never for an application.
Limits¶
- Pods on the host's network (
hostNetwork) aren't Cilium endpoints: these policies don't apply to them. - An application exposed through the Gateway (
docs/admin/gateway.md) lets it in:fromEntities: [ingress](Cilium's Envoy reaches the pods with that identity), on its ports.