From point A to point B
Point A: you know the theory and the components, but you haven't seen Cilium in action yet. Point B: by the end of this chapter you'll have a local cluster with Cilium, a published application, a network policy that lets one client through and blocks another, and Hubble showing you every decision.
The lab you're going to build. Diagram: The House of Routing.
Do these exercises on a test cluster, never in production. If you don't have local resources, Isovalent offers free in-browser labs (link at the end).
The tools
You need Docker (you installed it in topic 02), kubectl and four more pieces:
| Tool | What for | Check |
|---|---|---|
| kind | Spin up a Kubernetes cluster inside Docker containers | kind version |
| Cilium CLI | Install, inspect and test Cilium | cilium version --client |
| Hubble CLI | Query network flows | hubble version |
| Helm | Install Cilium with explicit values | helm version |
On macOS, you can install them all with Homebrew (brew install kind cilium-cli hubble helm). On Linux, the official documentation publishes this block for the Cilium CLI; it downloads the latest stable version and verifies its checksum:
CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)
CLI_ARCH=amd64
if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi
curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
The Hubble CLI installs the same way, swapping the repository for cilium/hubble:
HUBBLE_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/hubble/main/stable.txt)
HUBBLE_ARCH=amd64
if [ "$(uname -m)" = "aarch64" ]; then HUBBLE_ARCH=arm64; fi
curl -L --fail --remote-name-all https://github.com/cilium/hubble/releases/download/$HUBBLE_VERSION/hubble-linux-${HUBBLE_ARCH}.tar.gz{,.sha256sum}
sha256sum --check hubble-linux-${HUBBLE_ARCH}.tar.gz.sha256sum
sudo tar xzvfC hubble-linux-${HUBBLE_ARCH}.tar.gz /usr/local/bin
rm hubble-linux-${HUBBLE_ARCH}.tar.gz{,.sha256sum}
sha256sum --check is what you saw in the Linux topic: confirming the downloaded file is exactly the one the project published before you put it in /usr/local/bin.A kind cluster without a CNI
kind ships with its own network plugin (kindnetd). You turn it off so Cilium can take its place. Save this file as kind-cilium.yaml:
# THoR lab: 1 control plane + 2 workers, no default CNI
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
networking:
disableDefaultCNI: true
kind create cluster --config kind-cilium.yaml
kubectl get nodes
All three nodes show up as NotReady. That's not an error: the kubelet is reporting that there's no network plugin. Check it:
kubectl describe node kind-worker | grep -i "network"
# ... NetworkPluginNotReady ... cni plugin not initialized
Install Cilium
There are two paths. Both install the same thing; what changes is how much control you have.
cilium install | Helm | |
|---|---|---|
| Advantage | Detects the environment and proposes values for you | Explicit values you can version in Git |
| Best for | First experiments | Any environment you're going to maintain |
Before installing, see which values the CLI would propose for your cluster:
cilium install --dry-run-helm-values
On kind you'll see, among others, ipam.mode: kubernetes (each node uses the IP range Kubernetes assigns it) and routingMode: tunnel with tunnelProtocol: vxlan (traffic between nodes travels encapsulated). Chapters 4 and 5 explain both in depth. Now install with Helm, pinning the version:
helm repo add cilium https://helm.cilium.io/
helm repo update
helm install cilium cilium/cilium --version 1.20.3 -n kube-system \
--set ipam.mode=kubernetes \
--set routingMode=tunnel \
--set tunnelProtocol=vxlan \
--set operator.replicas=1
cilium status --wait
When cilium status shows Cilium, Operator and Envoy DaemonSet as OK, the nodes switch to Ready. There are the components from chapter 2: one agent and one Envoy per node, and one operator for the cluster.
kubectl get nodes
kubectl -n kube-system get daemonset cilium cilium-envoy
kubectl -n kube-system get deployment cilium-operator
The book was written for Cilium 1.18. The examples on this page use 1.20.3, the latest stable version at the time of writing. To pick another one, check the supported versions in the official documentation and change --version.
A test application
You're going to deploy a web server on kind-worker2 and two clients on kind-worker. Pinning pods to specific nodes isn't good practice in production, but here it forces traffic to cross between nodes through the VXLAN tunnel. Save this as lab-app.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 1
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
nodeSelector:
kubernetes.io/hostname: kind-worker2
containers:
- name: nginx
image: nginx:stable
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: web
spec:
selector:
app: web
ports:
- port: 80
targetPort: 80
---
apiVersion: v1
kind: Pod
metadata:
name: client
labels:
role: client
spec:
nodeSelector:
kubernetes.io/hostname: kind-worker
containers:
- name: netshoot
image: nicolaka/netshoot
command: ["sleep", "infinity"]
---
apiVersion: v1
kind: Pod
metadata:
name: intruder
spec:
nodeSelector:
kubernetes.io/hostname: kind-worker
containers:
- name: netshoot
image: nicolaka/netshoot
command: ["sleep", "infinity"]
kubectl apply -f lab-app.yaml
kubectl get pods -o wide --show-labels
Each pod gets an IP from its node's range. Test access from both clients; for now both get through, because with no policies everything is allowed:
# Only the HTTP code: 200 means it got through
kubectl exec client -- curl -s -o /dev/null -w "%{http_code}\n" http://web
kubectl exec intruder -- curl -s -o /dev/null -w "%{http_code}\n" http://web
You use the name web, not the pod IP: the service has a stable virtual IP and a DNS name (web.default.svc.cluster.local). Scale the deployment and watch its backends change:
kubectl scale deployment web --replicas=2
kubectl get endpointslices -l kubernetes.io/service-name=web
kubectl -n kube-system get ds kube-proxy). In chapter 6 you'll see how Cilium replaces it with eBPF.Your first network policy
Goal: only pods with the label role: client can reach web on port 80. Save this as web-policy.yaml:
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: web-allow-clients
spec:
endpointSelector: # who the policy protects
matchLabels:
app: web
ingress: # traffic coming into those pods
- fromEndpoints: # who is allowed in
- matchLabels:
role: client
toPorts: # on which port
- ports:
- port: "80"
protocol: TCP
The golden rule: with no policies, everything is allowed. As soon as a policy selects a pod in one direction (here, ingress), that pod switches to default deny in that direction and only accepts what the policy explicitly allows.
kubectl apply -f web-policy.yaml
kubectl exec client -- curl -s --max-time 3 -o /dev/null -w "%{http_code}\n" http://web
# 200
kubectl exec intruder -- curl -s --max-time 3 http://web
# command terminated with exit code 28 (timeout)
The intruder doesn't get a rejection: it gets silence. eBPF drops the packet in the kernel and the client waits until it times out.
Moving up to layer 7
Standard Kubernetes policies stop at IPs and ports. Cilium's can look inside the HTTP request. nginx ships with an error page, /50x.html, that any authorized client can request today. You're going to allow only GET /index.html. Add a rules block inside toPorts:
toPorts:
- ports:
- port: "80"
protocol: TCP
rules:
http:
- method: GET
path: "/index.html"
kubectl apply -f web-policy.yaml
kubectl exec client -- curl -s -o /dev/null -w "%{http_code}\n" http://web/index.html
# 200
kubectl exec client -- curl -s http://web/50x.html
# Access denied (HTTP 403)
Layer 3/4: the packet is dropped and the client times out. Layer 7: Envoy replies with a 403. Diagram: The House of Routing.
Notice the difference: at layer 7 the client does get a response, because the TCP connection is allowed and it's Envoy that rejects the specific request.
See everything with Hubble
The Hubble server already runs in every agent, but it only sees its own node. Enable Relay to get the cluster-wide view, and the UI for the visual map:
helm upgrade cilium cilium/cilium --version 1.20.3 -n kube-system \
--reuse-values \
--set hubble.relay.enabled=true \
--set hubble.ui.enabled=true
cilium status --wait # Hubble Relay: OK
The Hubble CLI connects to Relay; the -P option opens the port-forward for you:
hubble status -P
# What the intruder tried, and why it was dropped
hubble observe -P --from-pod default/intruder --verdict DROPPED
# Only the policy decisions
hubble observe -P -t policy-verdict --last 20
# The HTTP requests Envoy saw, with their response code
hubble observe -P --to-pod default/web --protocol http
For the visual map of who talks to whom:
cilium hubble ui
When you're done: kind delete cluster. You can recreate the whole lab in minutes with the three YAML files.
Challenge
Answer before you open the solution.
1. You just created the kind cluster and the nodes are NotReady. Why?
Because you disabled the default CNI and there's no network plugin yet. As soon as Cilium is installed, the kubelet reports the network is ready and the nodes switch to Ready.
2. After applying the policy, why does the intruder get a timeout instead of an error?
Because the rule is layer 3/4: eBPF drops the packet in the kernel and no response is sent.
3. Why does /50x.html return a 403 instead of a timeout?
Because the TCP connection is allowed and the request reaches Envoy, which applies the HTTP rule and replies "Access denied."
4. Which command shows only the policy decisions in Hubble?
hubble observe -t policy-verdict, which filters by event type.
What you take away
- A complete lab with kind:
disableDefaultCNI: trueand Cilium as the CNI. - Helm with a pinned version for reproducible installs;
cilium status --waitto confirm. - With no policies everything gets through; a policy that selects a pod turns it into "default deny."
- Layer 3/4: drop and timeout. Layer 7: Envoy and a 403.
- Hubble Relay and the UI show you every flow and every verdict.
In the next chapter: how Cilium assigns IP addresses to pods (IPAM) and which mode to choose for your environment.
Official resources
- Cilium Quick Installationdocs.cilium.io
- Setting up Hubble Observabilitydocs.cilium.io
- Network Policydocs.cilium.io
- kindkind.sigs.k8s.io
- Book examplesgithub.com
- Free Isovalent labsisovalent.com
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.