Skip to content

fix(k8s): the argocd and otel perimeters admit 0.0.0.0/0 ingress and deploy-stack applies neither #1371

Closed

Description

@dan-petty

Problem

Split from #913 (key question 3). devops k8s deploy-stack applies neither the argocd nor the otel perimeter, and neither can be applied safely as written. #913's guard test (test_every_network_policy_has_a_deploy_stack_path_or_an_owned_exemption, tests/test_k8s_network_policies.py) exempts both under this issue.

k8s/argocd/networkpolicy.yaml (argocd-default-perimeter)

k8s/otel/networkpolicy.yaml (otel-default-perimeter)

  • Since feat(k8s): argo cd keeps the homelab cluster at the current release branch, with automated sync, prune and self-heal that never delete data #755, Argo CD's otel Application syncs k8s/otel (k8s/argocd/apps/otel.yaml:13), so this policy is live on every cluster Argo CD manages. deploy-stack applies only otel/jaeger.yaml (_MANIFESTS_BY_STACK["infra"]), so a cluster without Argo CD has no otel perimeter at all.
  • Ingress rule 2 admits ipBlock: 0.0.0.0/0 on TCP 16686 (:31-32), next to the Traefik peer (:25-30) that already serves jaeger-ingress (ingress-routes.yaml:413). Under kube-router this admits every pod to the Jaeger UI, and it is live wherever Argo CD syncs the file. All four branch reviews of release/v0.2.25 reported it.
  • Rule 4 (:46-55) admits only monitoring on 8888, but otel-metrics-ingress routes Traefik to the collector on 8888 (ingress-routes.yaml:461). That route therefore fails under the policy.

Proposed remedy

  • otel:
    • drop the 0.0.0.0/0 peer from rule 2 and keep the Traefik peer;
    • add the Traefik peer to rule 4 on 8888;
    • give the policy a native deploy path, such as _MANIFESTS_BY_STACK["infra"].
  • argocd:
  • Delete both entries from UNDEPLOYED_NETWORK_POLICIES. The guard fails while an exempted policy is applied, so it forces this.

Acceptance criteria

  • Neither policy has an ingress ipBlock, pinned by a test like test_monitoring_ingress_admits_no_world_cidr.
  • Argo CD's API-server egress admits 6443 through an ipBlock peer, pinned by a test.
  • otel rule 4 admits Traefik on 8888.
  • A native deploy-stack applies both policies, and the guard test's argocd and otel exemptions are gone.
  • uv run devops ci passes.
  • Pending a person, on the homelab cluster:
    • kubectl diff -f both files, and settle each difference;
    • after the argocd policy applies, Argo CD stays Synced/Healthy: UI through Traefik, NodePort access, repo-server Git and Helm pulls, API server;
    • the Jaeger UI and otel-metrics routes answer through Traefik;
    • a pod in another namespace cannot reach 16686.

A mistake in Argo CD's policy stops GitOps sync, so its live check comes first. The owner chooses the milestone.

Related: #913, #953, #548, #737, #755, #1104.


Follow-up required by #913's pre-merge criterion (borrow reason: follow-up); #913's guard test exemptions cite this item. Filed directly with no priority; the roadmap service's intake sets Priority, Value and Effort.

Update 2026-10-08: refinement

#1082, #1387, #1393 and #1122 change k8s/argocd/networkpolicy.yaml and call this item only '#913's follow-up'; #1135 edits the k8s/otel/networkpolicy.yaml rules this item narrows (:31-35, :46-55). Applying the file keeps every rule that has landed; whichever lands second rebases.

Activity

  1. added
    type/security
    scope/k8s
    scope/security
    source/agent
    on Oct 8, 2026
  2. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P2-Medium. The otel 0.0.0.0/0 ingress is live wherever Argo CD syncs the file, but the blast radius is a homelab cluster and the fix requires careful live verification before merging.
    • Value: Medium. Closes a real network-isolation gap in a homelab cluster and unblocks the guard test, but the affected environment is a single-person homelab rather than a multi-tenant production system.
    • Effort: Medium. Requires editing rules in two policy files, adding deploy-stack paths, updating the guard-test exemption list, adding new tests, and performing live kubectl-diff and functional checks on a running cluster.
  3. added this to the v0.2.31 milestone on Oct 8, 2026
  4. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Placed in v0.2.31 on 2026-10-08 at the owner's request ("Populate 10 security and ci issues into each v0.2.30, v0.2.31, and v0.2.32 milestone"). This is a person's placement. Release theme: finding identity v2, URL credential masking, tests that leave no state, the Docker endpoint check and the Argo CD/OTel perimeters. Position 10 of 10 in the release's planned merge order. Its board Status is set to Ready, so the release-start fill keeps it.

  5. dan-petty-bot commented on Oct 9, 2026

    @dan-petty-bot
    Collaborator

    What changed

    #1482, merged into release/v0.2.31 as b7edb8f.

    Description

    Resolves #1371.

    Harden and integrate Kubernetes network policies for argocd and otel namespaces:

    • Argo CD (k8s/argocd/networkpolicy.yaml):
      • Replace open 0.0.0.0/0 ingress on ports 8080 and 443 with the specific Traefik peer (kube-system/traefik).
      • Add ipBlock peer (0.0.0.0/0 except 169.254.169.254/32) on the API server egress rule (ports 443, 6443, 8443) allowing Argo CD components to connect to Kubernetes API server node IPs.
      • Add argocd/networkpolicy.yaml to _MANIFESTS_BY_STACK["infra"].
    • OpenTelemetry (k8s/otel/networkpolicy.yaml):
      • Remove open 0.0.0.0/0 ingress from Jaeger UI (port 16686).
      • Add the Traefik peer to rule 4 on metrics port 8888, enabling the otel-metrics-ingress route to communicate with the collector through Traefik.
      • Add otel/networkpolicy.yaml to _MANIFESTS_BY_STACK["infra"].
    • Exemptions and Guard Tests:
      • Delete argocd and otel entries from UNDEPLOYED_NETWORK_POLICIES in tests/test_k8s_network_policies.py.
      • Add tests asserting that neither policy defines an ingress ipBlock, that Argo CD's API-server egress permits port 6443 via an ipBlock peer, and that OTel metrics ingress admits Traefik on port 8888.

    6 file(s) changed.

    How it was verified

    Check runs at 6541af5:

    • Prune PR DevContainer Images: pass
    • CodeQL: pass
    • Static Analysis: pass
    • Tests & Coverage: pass
    • Analyze (actions): pass
    • Analyze (python): pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1371-argocd-otel-perimeters.md:

    • Neither argocd nor otel perimeter has an ingress ipBlock, pinned by test_ingress_admits_no_world_cidr.
    • Argo CD's API-server egress admits 6443 through an ipBlock peer with metadata SSRF protection, pinned by test_argocd_api_server_egress_admits_6443_through_ipblock.
    • OTel rule 4 admits Traefik on port 8888, pinned by test_otel_rule_4_admits_traefik_on_8888.
    • A native deploy-stack applies both policies via _MANIFESTS_BY_STACK["infra"], and the guard test's argocd and otel exemptions are removed from UNDEPLOYED_NETWORK_POLICIES.
    • uv run devops ci passes with 100% checks green and coverage >= 90%.
    • Pending a person, on the homelab cluster:
      • kubectl diff -f k8s/argocd/networkpolicy.yaml and kubectl diff -f k8s/otel/networkpolicy.yaml, and settle each difference;
      • after the argocd policy applies, Argo CD stays Synced/Healthy: UI through Traefik, NodePort access, repo-server Git and Helm pulls, API server;
      • the Jaeger UI and otel-metrics routes answer through Traefik;
      • a pod in another namespace cannot reach 16686.
  6. added a commit that references this issue on Oct 9, 2026
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

    scope/k8sscope/securitysource/agenttype/security

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions