AoCN - Door 1 - Cilium

1.12.2026

kubernetesNetworkingCilium
Cilium network policy

Advent Of Cloud Native - Door 1 - Cilium

I feel like this is the first year we have Advent of Cloud Native besides Advent of Code. Really exciting stuff.

Let’s get into this challenge.

What’s the problem exactly?

Well, the problem is written under the mission:

AoCN door 1 missions

Let’s start from the beginning: explore the cluster (I removed most parts for brevity).


$ k get all --all-namespaces
NAMESPACE     NAME                         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
crew          service/game-server          ClusterIP   10.96.111.149   <none>        8080/TCP                 4h17m
station       service/heating-controller   ClusterIP   10.96.127.15    <none>        8080/TCP                 4h17m
station       service/satellite-uplink     ClusterIP   10.96.149.150   <none>        8080/TCP                 4h17m

NAMESPACE            NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE
crew                 deployment.apps/game-clients             1/1     1            1           4h17m
crew                 deployment.apps/game-server              1/1     1            1           4h17m
station              deployment.apps/heating-controller       1/1     1            1           4h17m
station              deployment.apps/satellite-uplink         1/1     1            1           4h17m


NAMESPACE   NAME                           SCHEDULE    TIMEZONE   SUSPEND   ACTIVE   LAST SCHEDULE   AGE
station     cronjob.batch/weather-report   0 * * * *   <none>     False     0        53m             4h17m

And because of the title of the challenge, there have to be resources related to Cilium as well (which we already have in manifests/policies).

Okayyy … what’s the problem??? Let’s do some analysis. This is what you will see in the README.md of the door 1 challenge:

I am POLARIS-7. I run this station, and you are its new winter-over engineer. The last flight is cancelled, so the crew is stuck here with us until February. Within three hours, they built a game server, with a “realistic weather” mod that reads my heating controller.

I pointed out that the network is wide open. They asked an AI to write network policies from the current traffic. It took ten seconds. Everyone went back to playing.

It is −31 °C outside. I would prefer the heating not to be multiplayer.

— POLARIS-7

Keep that in mind (especially the parts I made bold). Here is the game-client.yaml netpol generated by AI:

# Generated by StationAssist. Observed traffic: 2026-12-01 -> 03:04–03:14 UTC <- this is the problem
# Every observed flow is allowed. Confidence: 100%.
#
# game-clients: may call game-server.
# Ingress: no clients observed. Denied.
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: game-clients
  namespace: crew

So our AI just looked at the traffic for 10 minutes and generated the policy. Usually this is not enough, and in this case it is not enough because we have this cronjob weather-report, which runs every hour, so most probably the AI missed it (and yes, it did miss this part).

NAMESPACE   NAME                           SCHEDULE    TIMEZONE   SUSPEND   ACTIVE   LAST SCHEDULE   AGE
station     cronjob.batch/weather-report   0 * * * *   <none>     False     0        53m             4h17m

For me, the command given by README.md, kubectl logs -n crew deploy/game-clients, didn’t help at all; it just made it really confusing, and b/c of that I just went straight to the policy files to see what I could do.

Read policies

Starting from default-deny.yaml, we have two netpols applied to both the station and crew namespaces, and ingress is denied by default.

This is a good thing, and everything is correct here.

The next one to look at is game-client.yaml; here also everything is fine. The netpol is applied to the crew namespace, it does select the game-client deployment and allow egress to the game-server deployment on port 8080, which is correct as well.

Next, look at game-server.yaml; here also everything is fine. The netpol is applied to the crew namespace (where the deployment is) and it does allow ingress from the game-client deployment on port 8080 and egress from the game-server deployment to heating-controller in the station namespace.

Next, heating-controller.yaml: this is where things get interesting. Here is what the netpol looks like:

apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: heating-controller
  namespace: station
spec:
  endpointSelector:
    matchLabels:
      app: heating-controller
  ingress:
    - fromEndpoints:
        - matchLabels:
            k8s:io.kubernetes.pod.namespace: crew
            app: game-server
        # 2. We need to accept weather-report ingress as well
      toPorts:
        - ports:
            - port: "8080"
              protocol: TCP
          rules:
            http:
              - method: GET
                path: /temperature
              - method: POST # <- 1. This is the problem
                path: /setpoint

Why is POST /setpoint a problem?

POST /setpoint lets the game server change the real station’s heating temperature. The game only needs to read the outside temperature, not control the heating.

The cool part is, if you k describe the heating-controller deployment, you will get this:

$ k describe -n station deployments.apps heating-controller
Name:                   heating-controller
Namespace:              station
CreationTimestamp:      Tue, 01 Dec 2026 10:24:27 +0000
Labels:                 app=heating-controller
Annotations:            deployment.kubernetes.io/revision: 1
    read this  ->  description: Keeps the station warm. Knows the outside temperature. GET /temperature reads it, POST /setpoint changes the heating.

So if you leave POST /setpoint there, anyone in the GAME can change the temperature inside the station. Mad.

Okay, and how do we know that we need to add the weather-report cronjob to ingress as well?

$ k describe -n station cj weather-report
Name:                          weather-report
Namespace:                     station
Labels:                        <none>
 read this->Annotations:                   description: Every hour: reads the outside temperature from heating-controller and sends it home through satellite-uplink.

So the end result of the heating-controller.yaml netpol will look like this:

apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: heating-controller
  namespace: station
spec:
  endpointSelector:
    matchLabels:
      app: heating-controller
  ingress:
    - fromEndpoints:
        - matchLabels:
            k8s:io.kubernetes.pod.namespace: crew
            app: game-server
        - matchLabels:
            app: weather-report # <- add this
      toPorts:
        - ports:
            - port: "8080"
              protocol: TCP
          rules:
            http:
              - method: GET
                path: /temperature
                # remove POST /setpoint

The next problem is the fact that there is no network policy for the weather-report cronjob 🤦‍♂️

Based on the description of the weather-report cronjob, we need 2 egress policies: one for getting the temperature from heating-controller and another one to send POST /upload. Similarly, you can get that information by running k describe -n station deployments.apps satellite-uplink and reading the description.

Create a file, name it weather-report.yaml (or whatever you like), and write this:

apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: weather-report
  namespace: station
spec:
  endpointSelector:
    matchLabels:
      app: weather-report
  egress:
    - toEndpoints:
        - matchLabels:
            app: heating-controller
      toPorts:
        - ports:
            - port: "8080"
              protocol: TCP
          rules:
            http:
              - method: GET
                path: /temperature
    - toEndpoints:
        - matchLabels:
            app: satellite-uplink
      toPorts:
        - ports:
            - port: "8080"
              protocol: TCP
          rules:
            http:
              - method: POST
                path: /upload

Apply this network policy to weather-report, which can only send egress traffic to the heating-controller deployment on port 8080 and send GET requests to /temperature. It can also send egress traffic to the satellite-uplink deployment on port 8080 and only send POST /upload.

Next, move on to the satellite-uplink.yaml netpol; this is what it looks like at first:

apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: satellite-uplink
  namespace: station
spec:
  endpointSelector:
    matchLabels:
      app: satellite-uplink
  ingress:
    - {}
  egress:
    - {}

This blocked the legitimate POST /upload request from weather-report.

So change it to this:

# Generated by StationAssist. Observed traffic: 2026-12-01 03:04–03:14 UTC
# Every observed flow is allowed. Confidence: 100%.
#
# satellite-uplink: no traffic observed. Everything denied.
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: satellite-uplink
  namespace: station
spec:
  endpointSelector:
    matchLabels:
      app: satellite-uplink
  ingress:
    - fromEndpoints:
        - matchLabels:
            app: weather-report
      toPorts:
        - ports:
            - port: "8080"
              protocol: TCP
          rules:
            http:
              - method: POST
                path: /upload
  egress:
    - {}

And then run kubectl apply -f manifests/policies/, run aocn verify, and you are good to go.

solved