Skip to content

Harness egress NetworkPolicy blocks DNS on OVN-Kubernetes (harness cannot resolve any host) #102

Closed

Description

@pdettori

Summary

On an OpenShift 4.20 cluster using OVN-Kubernetes, the harness egress NetworkPolicy
(deploy/knative/harness-egress-policy.yaml, name serverless-harness-egress) prevents the
harness pod from performing any DNS resolution. A pod carrying the harness label
serving.knative.dev/service=serverless-harness cannot reach the cluster DNS service
(172.30.0.10:53), so it cannot resolve redis, the LLM host, or authbridge-ab1 — every
outbound connection that needs name resolution fails with a connection timeout.

This is pre-existing (the base policy, not AuthBridge-specific) and was invisible on Kind
because kindnet does not enforce NetworkPolicy egress. It was surfaced by the RC1-4 live gate on
OCP/OVN-K, where the tightened AuthBridge egress variant (harness-egress-ab1.yaml) inherits the
same broken DNS rule.

Root cause

The DNS egress rule uses ports: [{UDP,53},{TCP,53}] with no to: selector. Per the
NetworkPolicy spec that means "port 53 to all destinations", but on this cluster's OVN-K it does
not actually permit reaching the cluster DNS.

Evidence (A/B probes, harness-labeled pod, default namespace)

Egress policy on the pod DNS result
none resolves api.anthropic.com in 0.08s (HTTP 401, reachable)
base harness-egress-policy.yaml (ports:53, no to) times out reaching 172.30.0.10:53
tightened harness-egress-ab1.yaml (ports:53, no to) times out
to: namespaceSelector kubernetes.io/metadata.name=openshift-dns + ports:53 still times out

The unlabeled control (no policy selects the pod) resolves fine, so cluster→DNS and
cluster→internet egress are healthy; the block is specifically the egress policy on harness-labeled
pods, and the usual OpenShift fix (allow egress to the openshift-dns namespace) is not
sufficient here.

Impact

  • The harness cannot complete an agent turn on OVN-K (LLM call can't resolve its host) — this is
    why the RC1-4 gate's H1-allow claim fails while all secret-free / deny / inject claims pass
    (those don't require the harness pod itself to resolve a name).
  • Affects the flag-off default path too (base policy), i.e. any harness deployment on an
    enforcing CNI — not just the SH_AUTHBRIDGE path.

Candidate directions

  • Determine how pods actually reach DNS on this cluster (cat /etc/resolv.conf inside a harness
    pod). If the nameserver is a node-local address (host-network DNS), namespaceSelector/
    podSelector to: rules won't match it — an explicit ipBlock allowance (node CIDR / the
    resolver IP) on port 53 would be required.
  • Otherwise, an explicit to: podSelector for the CoreDNS (dns-default) pods in openshift-dns,
    or the node CIDR ipBlock, rather than the bare ports:53 rule.

Notes

  • Discovered by the RC1-4 OCP progression live gate. RC1-4 code needs no change to benefit —
    once DNS egress is fixed, re-running the gate should give a full 6/6 (currently 5/6).
  • The tightened harness-egress-ab1.yaml should get the same fix as the base policy.

Assisted-By: Claude (Anthropic AI) [email protected]

Activity

  1. added a commit that references this issue on Jul 14, 2026
    5585e5c
  2. pdettori commented on Jul 14, 2026

    @pdettori
    MemberAuthor

    Root cause confirmed + fixed (live OCP 4.20 / OVN-K)

    Root cause: OVN-Kubernetes enforces egress NetworkPolicy against the post-DNAT packet. The dns-default Service (172.30.0.10:53) DNATs to the CoreDNS pods on their real container port 5353 (the named dns/dns-tcp targetPort — the endpoints are 10.x.x.x:5353, and the pods are on the pod network, not hostNetwork). A rule matching port: 53 therefore never matches the translated DNS traffic, so the packet hits default-deny and every lookup times out.

    This also explains why the reporter's namespaceSelector: openshift-dns + port:53 attempt still failed — the selector was fine; the port was wrong. The node-local-DNS hypothesis is ruled out: resolv.conf is the standard nameserver 172.30.0.10 (cluster DNS service, not a node-local address).

    Evidence — A/B/C/D/E probe matrix (harness-labeled pod, default ns)

    Test Egress rule on pod DNS result
    A no policy resolves 0.007s
    B base: ports:53, no to timeout 40s
    D to: openshift-dns ns + ports:53 timeout 40s
    C to: openshift-dns ns + ports:5353 resolves 0.007s
    E ports:5353, no to resolves 0.004s

    The only variable between failing (D) and passing (C) is the port number — confirming the DNAT-port mismatch, not the selector.

    Fix

    Change the DNS egress rule from ports: 53 to to: namespaceSelector kubernetes.io/metadata.name=openshift-dns + ports: 5353 (UDP+TCP) in both deploy/knative/harness-egress-policy.yaml (base) and deploy/knative/authbridge/harness-egress-ab1.yaml (tightened AB1 variant), plus the manifest-shape vitest.

    Verification — RC1-4 live gate now 6/6

    Re-ran deploy/knative/rc1-ocp-gate.sh gate on OCP 4.20/OVN-K after the fix:

    --- Claim H1-allow: AB1 allow-path: a leaf only completes if AB1 injected the real key ---
    PASS: allow-path leaf completed (real key injected at AB1)
    ...
    === Results: 16 passed, 0 failed ===
    LEAF SMOKE PASS
    SMOKE_EXIT:0
    

    All 6 AuthBridge claims pass (H2-secret-free, H2-inject, H2-deny, H1-secret-free, H1-allow, H1-deny) — previously 5/6. Namespace auto-restored to base state.

    Fix committed on feat/rc1-4-ocp.

    Assisted-By: Claude (Anthropic AI) [email protected]

  3. added 2 commits that reference this issue on Jul 14, 2026
    076a028
    f0020d2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions