Skip to content

fix(k8s): narrow the in-namespace egress of the object store - #6712

Merged
dan-petty merged 7 commits into
mainfrom
fix/6707-object-store-egress
Nov 22, 2026
Merged

dan-petty merged 7 commits into
mainfrom
fix/6707-object-store-egress

Conversation

@dan-petty

@dan-petty dan-petty commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

The in-namespace egress rule of object-store-perimeter now has the 9 ports of its in-namespace ingress rule. Before, it had no ports. The network policy controller of the cluster, kube-router, does not apply the ingress rules of a policy with the types Ingress and Egress to traffic that an egress rule of the same policy allows, when the policy selects the source and the destination pod. The perimeter selects each pod of the namespace. So each pod of the namespace reached the admin gRPC port 33646, which has no authentication (GHSA-3qr2-qw48-cj6q), and the metrics port 9327 of the other pods.

The new policy object-store-worker lets only the worker pods send to the admin pod on 33646. The ingress rules do not change. The components and the operator use only ports of the list between them.

The admin port rule of the k8s row now also reads the egress rules of the policies of namespace object-store. It refuses each such policy that lets a pod other than the worker send to 33646, also through a rule with no ports, and a worker that cannot send to it. A policy selects only pods of its own namespace, so the ingress rules of the perimeter hold for the pods of other namespaces.

Closes #6707

Change: openspec/changes/archive/2026-11-21-6707-object-store-egress/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/k8s Kubernetes commands, Helm charts, pods, services, and policies labels Nov 22, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Steps for a person after Argo CD syncs main (the live criteria of #6707; nobody applied the change to the cluster):

kubectl -n object-store exec seaweedfs-filer-0 -- nc -z -w 3 seaweedfs-admin 33646; echo "filer: exit $?"                   # 1
kubectl -n object-store exec deploy/seaweedfs-worker -c worker -- nc -z -w 3 seaweedfs-admin 33646; echo "worker: exit $?"    # 0
V=$(kubectl -n object-store get pod seaweedfs-volume-1 -o jsonpath='{.status.podIP}')   # a volume pod on another node than seaweedfs-filer-0
kubectl -n object-store exec seaweedfs-filer-0 -- nc -z -w 3 "$V" 9327; echo "filer to volume metrics: exit $?"              # 1
kubectl -n object-store get seaweed seaweedfs -o jsonpath='{.status.conditions[0].message}'                                  # Seaweed cluster is ready
kubectl -n object-store get pods                                                                                              # 13 pods Ready

Review points

  1. Ports between the components. The established TCP connections of the 12 SeaweedFS pods on 2026-11-21 (/proc/net/tcp, read-only) gave 14 pairs of source, destination and port. All go to 9333, 19333, 18444 or 18888, except the worker to the admin Service on 33646. At tag seaweedfs-operator-0.1.48, the operator dials 19333 (masters, through weed shell), 18888 (filer, IAM and bucket policy clients) and 18444 (volumeServer.evacuate). It reads its ready condition from the Kubernetes API. All of these ports are in the narrowed list. kubectl diff -f k8s/object-store/networkpolicy.yaml (server-side dry run) shows only the 9 ports and the new policy.
  2. ADR 0034 gets no Status History line. Its text says that only the worker reaches the admin gRPC port. That is true after the merge, and docs/adr/README.md adds a line only when a pull request makes a fact of a record wrong. Tell me if you want a line for the time from feat(k8s): run a three-node SeaweedFS object store #4750 to this merge.
  3. Across namespaces the ingress rule holds in one probe. llm-default-perimeter has an egress rule to 0.0.0.0/0 (metadata address excluded) with no ports. From an Ollama pod of llm, a TCP connect to the admin pod gave exit 1 on 33646 and on 9327, and exit 0 to CoreDNS on TCP 53 (the control). So in this probe the controller skipped the ingress rules only for traffic inside one namespace. This is a fact for fix(k8s): an in-namespace egress allow skips the ingress rules #6708. This pull request needs no change for it.
  4. Metrics port. This pull request adds no rule of its own for 9327. The narrowed list stops the path, and the general row of fix(k8s): an in-namespace egress allow skips the ingress rules #6708 will refuse an in-namespace egress rule with no ports.

…e scope

The network policy controller skips the ingress rules of a policy with
both types only for traffic that an egress rule of the same policy
allows. A policy selects only pods of its own namespace, so the ingress
rules of object-store-perimeter hold for the pods of other namespaces.
The admin port text, the spec and the check docstring now say that the
k8s row reads the policies of namespace object-store.
@dan-petty
dan-petty force-pushed the fix/6707-object-store-egress branch from 94dbffa to ef8f24e Compare November 22, 2026 00:29
@dan-petty
dan-petty marked this pull request as ready for review November 22, 2026 00:37
@dan-petty
dan-petty merged commit f14cb8b into main Nov 22, 2026
31 checks passed
@dan-petty
dan-petty deleted the fix/6707-object-store-egress branch November 22, 2026 00:48
dan-petty-release Bot added a commit that referenced this pull request Nov 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.191.0](v0.190.0...v0.191.0)
(2026-11-22)


### Features

* **infra:** add node drain, uncordon, restart and reboot
([#6706](#6706))
([8af846c](8af846c)),
closes [#5128](#5128)
* **monitoring:** keep the cAdvisor container_threads series
([#6711](#6711))
([349adda](349adda))


### Bug Fixes

* **ci:** check release image job times in devops ci job-time
([#6635](#6635))
([1b1a25e](1b1a25e))
* **k8s:** narrow the in-namespace egress of the object store
([#6712](#6712))
([f14cb8b](f14cb8b)),
closes [#6707](#6707)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(k8s): narrow the in-namespace egress of the object store

1 participant