stacklok / stacklok/mecatl

mecak8s: isolate the unauthenticated drain endpoint from workload traffic

Open
#1,523 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
152
Forks
16
Avg merge
14h 48m
Merged PRs (30d)
536

Description

Problem

mecak8s binds an unauthenticated drain listener to 0.0.0.0:8082. GET /drain irreversibly marks the process draining and unready, but the chart creates no NetworkPolicy selecting the agent pods. Any workload with direct Pod-IP reachability can therefore remove replicas from service.

Issue #656 deliberately separated /drain from the client HTTP API, but direct pod-network access remains an operator obligation rather than a chart-enforced boundary.

Evidence

  • deploy/helm/mecak8s/templates/deployment.yaml: --drain-addr=0.0.0.0:8082, the drain container port, and the preStop HTTP hook.
  • cmd/mecak8s/serve.go: drainHTTPMux calls svc.Drain() before returning 200.
  • deploy/helm/mecak8s/templates/raw-driver-networkpolicy.yaml does not select agent pods.

Proposed direction

Provide a default or explicitly enabled ingress-isolation policy that allows normal API/probe traffic while preventing workload access to port 8082, and test it with the supported CNI/kubelet lifecycle behavior. If a portable policy cannot guarantee kubelet access, redesign the lifecycle mechanism or fail closed with a prominently validated operator contract.

Acceptance criteria

  • Untrusted pods cannot invoke an agent pod's drain endpoint.
  • The kubelet preStop hook continues to work on supported Kubernetes/CNI configurations.
  • Normal gRPC, HTTP, readiness, and liveness traffic remains functional.
  • The Kind/e2e suite proves both allowed and denied paths.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with deploy/helm/mecak8s/templates/deployment.yaml and raw-driver-networkpolicy.yaml, then inspect cmd/mecak8s/serve.go to understand the drain listener and preStop hook. Run the Kind/e2e suite and trace supported CNI and kubelet behavior. Done means workload access to port 8082 is denied while kubelet lifecycle calls and normal gRPC, HTTP, readiness, and liveness traffic continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, helm, kubernetes
Domain
devops, networking, security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.