CILIUM · CILIUM: UP AND RUNNING · CHAPTER 4

IP address management (IPAM)

Who hands out your pods' IPs, how to grow without reinstalling and when to make the jump to IPv6.

7 min readBook: Cilium: Up and RunningLevel: intermediate

From point A to point B

Point A: in chapter 3 your pods got an IP and everything worked, but you didn't choose how. Point B: by the end of this chapter you'll be able to choose the right IP address management (IPAM) mode for your cluster, decide between IPv4, IPv6 or both, and know why that decision is made before you install.

Decide it up front

Changing the IPAM mode on a running cluster can cut connectivity for the workloads already running. The official documentation recommends creating a new cluster with the new configuration. The only live migration available today is from Cluster Scope to Multi-Pool, and it has its own guide.

What IPAM is and what a PodCIDR is

Outside Kubernetes, a machine gets its IP through DHCP or, with IPv6, through SLAAC. In Kubernetes, assigning IPs to pods is called IPAM (IP Address Management), and it's usually the CNI plugin's job.

Each node receives one or more address blocks called PodCIDRs, and the pods on that node take their IP from there. The question is who hands out those blocks. Depending on the answer, you have one IPAM mode or another:

Three IPAM modes Kubernetes Host Scope: the controller manager gives each node one PodCIDR of the same size. Cluster Scope, the default: the Cilium operator assigns PodCIDRs from Cilium's own pool through CiliumNode objects. Multi-Pool: several CiliumPodIPPool objects, selected per namespace or pod, and the operator hands out more blocks to a node when it needs them. HOST SCOPE CLUSTER SCOPE MULTI-POOL DEFAULT Kubernetescontroller manager Cilium operatorone pool for the cluster CiliumPodIPPool × Ndefault · store · payments Node.spec.podCIDR CiliumNode.spec.ipam CiliumNode · per pool node10.244.1.0/24 node10.0.1.0/24 node 10.20.0.0/27 10.30.0.0/27 simple · same size for every node pool cannot grow no Kubernetes config needed pool fixed once the cluster runs pool per namespace or pod nodes get more blocks on demand

Who hands out the blocks in each mode. Diagram: The House of Routing.

ModeWho assignsUse it when
Kubernetes Host ScopeKubernetes (controller manager)You want the simplest option and your cluster already defines PodCIDRs
Cluster Scope (default)The Cilium operatorYou want Cilium to manage its own ranges without touching Kubernetes
Multi-PoolThe operator, from several poolsYou need ranges per team or per customer, or ranges that grow without reinstalling
ENIAWS, through the operatorYou run on Amazon EKS and want IPs from the VPC itself
Connecting to what you know. A CIDR like 10.244.1.0/24 is the same notation you use for subnets in traditional networking: 24 network bits and 256 addresses for the pods on that node.

Kubernetes Host Scope

This is the mode you used in chapter 3 (ipam.mode=kubernetes). Kubernetes has one prefix for the whole cluster (on kind, 10.244.0.0/16) and gives each node a /24. Cilium only hands out IPs within that block.

# The block Kubernetes assigned to each node
kubectl get nodes -o custom-columns=NODE:.metadata.name,PODCIDRS:.spec.podCIDRs

It's easy to understand, but rigid:

  • The block size is the same for every node; you can't give more addresses to just one.
  • You can't add or remove ranges as the cluster grows.

Cluster Scope, the default mode

Here the one handing out blocks is the Cilium operator, not Kubernetes. It writes each node's block into its CiliumNode object and the agent reads it. Since it needs nothing special from Kubernetes, it's the mode Cilium uses if you don't specify another. In Helm it shows up as cluster-pool.

To try it, create a new cluster with the kind-cilium.yaml from chapter 3 and install Cilium without setting ipam.mode:

kind delete cluster
kind create cluster --config kind-cilium.yaml
helm install cilium cilium/cilium --version 1.20.3 -n kube-system
cilium status --wait

# The cluster pool and the block size per node
cilium config view | grep cluster-pool

# The block the operator gave each node
kubectl get ciliumnodes -o custom-columns=NODE:.metadata.name,PODCIDRS:.spec.ipam.podCIDRs

By default, the pool is 10.0.0.0/8 and each node gets a /24. Besides your pods' IPs, the agent reserves a few for itself: one for the router (cilium_host) and another for health checks.

When the pool runs short

Cluster Scope supports several ranges, but they're fixed at install time. If you run out of addresses, you can't expand them live. See it for yourself with a deliberately small pool:

# values-small-pool.yaml · lab only
ipam:
  mode: cluster-pool
  operator:
    clusterPoolIPv4PodCIDRList:
      - 10.99.0.0/28
      - 10.99.1.0/28
    clusterPoolIPv4MaskSize: 29

Each node gets a /29, that is, eight addresses. If you pin ten replicas to the same node, several stay in ContainerCreating. That node's agent tells you why:

# The agent running on kind-worker2
AGENT=$(kubectl -n kube-system get pods -l k8s-app=cilium \
  --field-selector spec.nodeName=kind-worker2 -o name)

kubectl -n kube-system exec $AGENT -- cilium-dbg status | grep IPAM
# IPAM:  IPv4: 6/6 allocated from 10.99.1.0/29

Multi-Pool: pools per namespace

Multi-Pool is the most flexible mode. You define several pools with the CiliumPodIPPool resource and decide which pods use each one. A single node can hold blocks from several pools, and the operator hands it new blocks when it needs them.

Multi-Pool: one pool per namespace The store namespace is annotated with ipam.cilium.io/ip-pool equal store-pool and the payments namespace with payments-pool. Each pool owns a /16. The operator gives the node a /27 block from each pool, and a second /27 from store-pool when the store deployment scales up. NAMESPACES POOLS NODE · KIND-WORKER2 storeipam.cilium.io/ip-pool= store-pool paymentsipam.cilium.io/ip-pool= payments-pool store-pool10.20.0.0/16 payments-pool10.30.0.0/16 10.20.0.0/27 10.20.0.32/27 10.30.0.0/27 +1 BLOCK AT SCALE-UP Pods take their IP from the pool of their namespace. Use pools to organise traffic, not to isolate it: a pod annotation can also request a pool. Isolation is the job of network policies.

Each namespace takes its IPs from its own pool. Diagram: The House of Routing.

Install it on a new cluster. This lab uses native routing, which we cover in depth in chapter 5:

# values-multi-pool.yaml
ipam:
  mode: multi-pool
  operator:
    autoCreateCiliumPodIPPools:
      default:
        ipv4:
          cidrs: ["10.10.0.0/16"]
          maskSize: 27
routingMode: native
autoDirectNodeRoutes: true
ipv4NativeRoutingCIDR: 10.0.0.0/8
endpointRoutes:
  enabled: true

autoCreateCiliumPodIPPools creates a default pool at startup. Now add a pool for each team:

# pools.yaml
apiVersion: cilium.io/v2alpha1
kind: CiliumPodIPPool
metadata:
  name: store-pool
spec:
  ipv4:
    cidrs: ["10.20.0.0/16"]
    maskSize: 27
---
apiVersion: cilium.io/v2alpha1
kind: CiliumPodIPPool
metadata:
  name: payments-pool
spec:
  ipv4:
    cidrs: ["10.30.0.0/16"]
    maskSize: 27

To make every pod in a namespace use a pool, annotate the namespace with ipam.cilium.io/ip-pool:

kubectl apply -f pools.yaml
kubectl create namespace store
kubectl create namespace payments
kubectl annotate namespace store ipam.cilium.io/ip-pool=store-pool
kubectl annotate namespace payments ipam.cilium.io/ip-pool=payments-pool

kubectl -n store create deployment web --image=nginx:stable --replicas=10
kubectl -n payments create deployment web --image=nginx:stable --replicas=10
kubectl get pods -A -o wide | grep web

# The blocks each node holds, pool by pool
kubectl get ciliumnode kind-worker2 -o jsonpath='{.spec.ipam.pools}' | jq

Pods in store come from 10.20.x.x and pods in payments from 10.30.x.x. Scale one of them and you'll see the node receive a second /27 without reinstalling anything:

kubectl -n store scale deployment web --replicas=40
kubectl get ciliumnode kind-worker2 -o jsonpath='{.spec.ipam.pools.allocated}' | jq
Organizing isn't isolating

Giving each team its own range helps you recognize traffic when it leaves the cluster. But a pod can also request a pool with its own annotation, so a pool isn't a security boundary. To isolate, use network policies (chapters 12 and 13).

ENI on AWS

On Amazon EKS, ENI mode assigns pods secondary addresses from each EC2 instance's elastic network interfaces (ENIs). Pods get real VPC IPs, and AWS security groups can be applied at the pod level.

  • Turn it on with ipam.mode=eni and eni.enabled=true.
  • Limit: the number of pods per node depends on how many ENIs and how many secondary IPs the instance type supports. For example, an m5.large supports 3 ENIs with 10 addresses each, about 30 pods. AWS prefix delegation assigns whole blocks (for example, /28) to each ENI and raises that number a lot.
  • No IPv6: today Cilium's ENI mode doesn't support IPv6 ENIs.

On clouds that come with another CNI preinstalled (EKS or GKE, for example), Cilium can use a taint (node.cilium.io/agent-not-ready) that keeps pods from being scheduled on a node until its agent is ready. That way pods are born managed by Cilium and not by the previous CNI.

Watch the bill. An EKS cluster costs money. If you create one to practice, delete it when you're done.

IPv4, IPv6 or dual stack

Cilium was born IPv6-only and added IPv4 very early, because the ecosystem wasn't ready yet. Today almost all of its features support IPv6. The three options:

OptionAdvantageCost
IPv4 onlyMaximum compatibility; it's the normDoesn't prepare you for the future
Dual stackYou try IPv6 without losing IPv4; a good transitionMore complexity in addressing and observability
IPv6 onlyHuge address space; ideal for new projectsYou need NAT64/DNS64 to reach services that only speak IPv4

Before you decide, ask yourself: does your organization require IPv6? Do your monitoring and security tools understand IPv6? Do your external dependencies, such as some container registries, work without IPv4?

Dual stack lab

On Linux with IPv6 enabled, add ipFamily: dual to your kind configuration:

# kind-dual.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
  - role: worker
  - role: worker
networking:
  disableDefaultCNI: true
  ipFamily: dual

In Cilium, IPv6 is disabled by default; turn it on at install time:

kind create cluster --config kind-dual.yaml
helm install cilium cilium/cilium --version 1.20.3 -n kube-system \
  --set ipam.mode=kubernetes \
  --set ipv6.enabled=true
cilium status --wait

# Each node now has an IPv4 block and an IPv6 block
kubectl get nodes -o custom-columns=NODE:.metadata.name,PODCIDRS:.spec.podCIDRs

You request a dual stack service with ipFamilyPolicy:

apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  ipFamilyPolicy: PreferDualStack
  ipFamilies: [IPv6, IPv4]
  selector:
    app: web
  ports:
    - port: 80
# From a client pod, the same service over both families
kubectl exec client -- curl -s -o /dev/null -w "%{http_code}\n" -4 http://web
kubectl exec client -- curl -s -o /dev/null -w "%{http_code}\n" -6 http://web

On an IPv6-only cluster, use ipFamily: ipv6 in kind, install Cilium with ipv6.enabled=true and ipv4.enabled=false, and declare services with ipFamilyPolicy: SingleStack and ipFamilies: [IPv6].

Example ranges. Labs and documentation use 2001:db8::/32, which is reserved for examples only. In production, take pod ranges from your organization's public IPv6 block and use unique local addresses (ULA) for internal services.

Challenge

Answer before you open the solution.

1. You install Cilium without setting ipam.mode. Which mode does it use?

Cluster Scope (cluster-pool). The operator hands out blocks from 10.0.0.0/8 and writes them into each CiliumNode.

2. Your pods are stuck in ContainerCreating and cilium-dbg status shows "6/6 allocated." What happened?

The node's block ran out. In Cluster Scope you can't expand it live; in Multi-Pool, the operator would have handed out another block.

3. How do you make every pod in the payments namespace come from a specific pool?

By annotating the namespace with ipam.cilium.io/ip-pool=<pool>, in Multi-Pool mode.

4. Why should you decide the IPAM mode before installing?

Because changing it on a running cluster can break connectivity for existing workloads; the safe path is to create a new cluster.

What you take away

  • IPAM decides who hands out PodCIDRs: Kubernetes, the Cilium operator or several pools.
  • Cluster Scope is the default mode; Multi-Pool is the most flexible and grows live.
  • ENI gives you VPC IPs on EKS, with a pod limit per instance type.
  • IPv4, dual stack or IPv6 only: decide based on your strategy, your tools and your dependencies.
  • The IPAM mode and the IP family are chosen before you install.

In the next chapter you follow the packet: how it travels between pods on the same node and between nodes, with native routing or with tunnels.

Official resources

Source and credits. This chapter summarizes and paraphrases the official book Cilium: Up and Running by Nico Vibert, Filip Nikolic and James Laverack (O'Reilly Media, 2026). The summary was produced with AI and reviewed, verified and approved by Jesús Espinoza. The diagrams and code examples are original work by The House of Routing and were checked against the official Cilium documentation. Cilium: Up and Running, the cover image, and related trade dress are trademarks of O'Reilly Media, Inc. This content is not affiliated with or endorsed by O'Reilly Media or Isovalent.

Navigate