Skip to content

feat(k8s): deploy MCP server manifests when entrypoint exists #3600

Open

Description

@devops-cli-service

Update 2026-11-26 (infra move): k8s/monitoring/prometheus-values.yaml is now in dan-petty/homelab.

  • Put McpServerDown in the product rules, k8s/devops/monitoring/prometheus-rules-values.yaml.
  • k8s/devops/mcp-server/ already holds a Deployment, a Service and NetworkPolicies, and the mcp-server image target exists. Check what is still missing before you build.

Split from #3220.

Problem: The repository has no Kubernetes manifest set for the MCP server. The roadmap jobs cannot reach a role-scoped server, and other pods are not blocked from calling it. Why deferred: The MCP server entrypoint from the related issue feat(mcp): serve role-scoped tool sets over authenticated HTTP is not in the repository at the staging commit. A Deployment would start a container with no server process. The image target lands first in this issue. Acceptance criteria: - k8s/devops/mcp-server/ SHALL hold a Deployment, a Service, a ServiceAccount, a Role and a NetworkPolicy. - The Deployment SHALL run one replica until the server proves stateless streamable HTTP. - The NetworkPolicy SHALL allow ingress only from pods labeled app.kubernetes.io/name: devops-cli-job and app.kubernetes.io/name: roadmap-service. - The NetworkPolicy SHALL name each allowed egress destination and port, and SHALL have no rule that allows all egress. - The pod SHALL run as non-root with a read-only root filesystem. - The Deployment SHALL set OTEL_SERVICE_NAME to mcp-server. - A test SHALL fail when the Role grants a verb other than get, list or watch. - The Service SHALL be a ClusterIP Service, and no Ingress SHALL name it. - The monitoring rules SHALL add McpServerDown on `up{job=

Proposed design

Problem statement

The repository has no Kubernetes manifest set for the MCP server. The roadmap jobs cannot reach a role-scoped server, and other pods are not blocked from calling it. This issue adds the Deployment, Service, ServiceAccount, Role and NetworkPolicy. It also adds the image target, the Role verb test and the McpServerDown alert.

Acceptance criteria

Requirement: Manifest set

k8s/devops/mcp-server/ SHALL hold a Deployment, a Service, a ServiceAccount, a Role and a NetworkPolicy.

Scenario: Manifest kinds

  • WHEN The test parses the files under k8s/devops/mcp-server/.
  • THEN The set contains exactly one Deployment, one Service, one ServiceAccount, one Role and one NetworkPolicy.

Requirement: Single replica

The Deployment SHALL run one replica until the server proves stateless streamable HTTP.

Scenario: Replica count

  • WHEN The test reads the Deployment spec.
  • THEN spec.replicas is 1.

Requirement: Ingress peers

The NetworkPolicy SHALL allow ingress only from pods labeled app.kubernetes.io/name: devops-cli-job and app.kubernetes.io/name: roadmap-service.

Scenario: Allowed ingress labels

  • WHEN The test reads the NetworkPolicy ingress rules.
  • THEN Every ingress peer selects one of those two label values, and no rule selects another pod.

Requirement: Explicit egress

The NetworkPolicy SHALL name each allowed egress destination and port, and SHALL have no rule that allows all egress.

Scenario: Egress rule shape

  • WHEN The test reads the NetworkPolicy egress rules.
  • THEN Every egress rule has a non-empty to and a non-empty ports, and no rule has an empty to or ports.

Requirement: Pod security

The pod SHALL run as non-root with a read-only root filesystem.

Scenario: Security context

  • WHEN The test reads the Deployment pod and container security contexts.
  • THEN runAsNonRoot is true and readOnlyRootFilesystem is true.

Requirement: OTEL service name

The Deployment SHALL set OTEL_SERVICE_NAME to mcp-server.

Scenario: OTEL environment variable

  • WHEN The test reads the container environment variables.
  • THEN OTEL_SERVICE_NAME equals mcp-server.

Requirement: Role verb test

A test SHALL fail when the Role grants a verb other than get, list or watch.

Scenario: Forbidden Role verb

  • WHEN The Role test runs against a Role with the verb create.
  • THEN The test fails and names the forbidden verb.

Requirement: ClusterIP only

The Service SHALL be a ClusterIP Service, and no Ingress SHALL name it.

Scenario: Service exposure

  • WHEN The test reads the Service and all Ingress manifests.
  • THEN The Service type is ClusterIP, and no Ingress backend names the Service.

Requirement: MCP server down alert

The monitoring rules SHALL add McpServerDown on up{job="mcp-server"} == 0.

Scenario: Alert rule

  • WHEN The test parses the PrometheusRule.
  • THEN An alert named McpServerDown exists with that expression.

Requirement: MCP server image target

The Dockerfile SHALL define an mcp-server target that runs the MCP server HTTP entrypoint.

Scenario: Image target

  • WHEN The test parses the Dockerfile.
  • THEN A stage named mcp-server exists and its entrypoint invokes the MCP server command.

Existing Tool Considered

No alternatives check has run. The repository keeps raw Kubernetes manifests under k8s/devops/. No open tool covers this specific manifest set. kube-linter validates YAML. It does not write the Deployment, RBAC, NetworkPolicy or the Role verb test. Building and keeping the YAML and test by hand costs about 3,000 tokens and one hour.

Key questions

  • Which directory and file layout should hold the MCP server manifests?: Use k8s/devops/mcp-server/ with one YAML file for each kind, as k8s/devops/roadmap-service/ does. (best practice) [sources: k8s/devops/roadmap-service/deployment.yaml, k8s/devops/cronjob-runner.yaml]
    • Chosen: Separate files for each kind. The existing k8s/devops/ manifests use separate files for each kind.
    • Rejected: One combined YAML file. It departs from the existing layout and makes the Role test parse more complex.
  • Which namespace and labels should the manifests use?: Use namespace devops and label app.kubernetes.io/name: mcp-server. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md, k8s/devops/roadmap-service/deployment.yaml]
    • Chosen: devops namespace with app.kubernetes.io/name: mcp-server. ADR 0004 places the service Secret in namespace devops, and existing manifests use app.kubernetes.io/name.
    • Rejected: default namespace. It departs from the existing deployment namespace.
    • Rejected: A new mcp namespace. No repository evidence supports a new namespace.
  • Does this issue wait on the MCP server entrypoint issue?: No. The repository already has tests/ai/mcp/test_mcp_http.py, so the HTTP entrypoint is present. This issue adds manifests for that entrypoint. [sources: tests/ai/mcp/test_mcp_http.py, tests/ai/mcp/test_fastmcp_contracts.py]
  • Which command and HTTP port should the Deployment and Service use?: Use the MCP server HTTP entrypoint and its port. The existing tests/ai/mcp/test_mcp_http.py shows the HTTP transport. (best practice) [sources: tests/ai/mcp/test_mcp_http.py, tests/ai/mcp/test_fastmcp_contracts.py]
    • Chosen: Reuse the existing MCP HTTP entrypoint and its port. The repository already tests an MCP HTTP server, so the Deployment must not start a second command.
    • Rejected: Add a new command and port in this issue. The issue deploys manifests and does not add a server process.
  • How should the NetworkPolicy restrict ingress?: Set policyTypes to Ingress and Egress. Allow ingress only from pods in namespace devops with app.kubernetes.io/name equal to devops-cli-job or roadmap-service. Deny all other ingress. (best practice) [sources: k8s/devops/roadmap-service/deployment.yaml, k8s/devops/cronjob-runner.yaml]
    • Chosen: Label selectors for the two callers. The issue names the two caller labels and the existing manifests set them.
    • Rejected: Allow all pods in the devops namespace. It admits pods that the issue does not name.
    • Rejected: Allow all ingress. It defeats the purpose of the NetworkPolicy.
  • Which egress destinations and ports should the NetworkPolicy allow?: Allow only DNS to kube-system on UDP and TCP 53, the Kubernetes API on TCP 443 for the Role's get, list and watch, and the OTLP collector endpoint that the existing deployments use. Add no all-egress rule. (best practice) [sources: k8s/devops/roadmap-service/deployment.yaml, k8s/monitoring/prometheus-values.yaml]
    • Chosen: Explicit DNS, Kubernetes API and OTLP rules. The server needs DNS, the Role needs the API, and OTEL_SERVICE_NAME needs the collector.
    • Rejected: Allow all egress. The issue forbids a rule that allows all egress.
  • How should the Role verb restriction be tested?: Add a test under tests/k8s/ that parses the Role and fails if any rule has a verb outside get, list and watch. (best practice) [sources: tests/k8s/test_kubernetes_contract.py, tests/k8s/test_k8s_service.py]
    • Chosen: A dedicated Role parsing test. The repository already has Kubernetes contract tests, and kube-linter cannot enforce this verb allowlist.
    • Rejected: Rely on kube-linter. kube-linter does not fail on an extra Role verb.
  • Where should the McpServerDown alert live?: Add McpServerDown to k8s/devops/monitoring/prometheus-rules-values.yaml, with expression up{job="mcp-server"} == 0. (best practice) [sources: k8s/monitoring/prometheus-values.yaml, tests/prometheus/test_k8s_monitoring_alerting.py]
    • Chosen: Add the alert to the existing PrometheusRule. The repository keeps monitoring rules there and already tests them.
    • Rejected: Create a new PrometheusRule. It splits related alerts and departs from the existing monitoring layout.
  • Should the image target be part of this issue?: Yes. Add a Dockerfile stage named mcp-server that runs the MCP HTTP entrypoint, as the body says the image target lands first in this issue. (best practice) [sources: tests/ai/mcp/test_mcp_http.py, tests/ai/mcp/test_docker_cosign.py]
    • Chosen: Add the image target in this issue. The issue body says the image target lands first in this issue.
    • Rejected: Defer the image target to a new issue. It would leave the Deployment with no image to run.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    scope/k8s
    status/new
    value/high
    effort/medium
    on Nov 5, 2026
  2. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    ContributorAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P2-Medium. The work is blocked on the MCP server entrypoint landing first, so it is needed but not immediately actionable.
    • Value: High. Without these manifests the roadmap jobs cannot reach a role-scoped MCP server in the cluster.
    • Effort: Medium. Five manifest kinds, a security test, and a monitoring rule must be written and reviewed.
    • Related: feat(k8s): deploy the MCP server for the roadmap jobs #3220, which asks for a different change. Both add manifests in k8s/devops/mcp-server/, but the candidate is a sibling split from #3220 with its own acceptance criteria.
  3. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at bd65ef6. A bot opened the item, so a review of the issue and of the proposal must approve it first. The review found the defects below. A person edits the body to answer them. The next refine round looks at the item again only after a body edit.

    • false_premise at key_questions: Does this issue wait on the MCP server entrypoint issue?: The plan infers that the entrypoint exists because a test file exists. The issue says the entrypoint is not in the repository, and nothing in the input shows it. The Deployment and the image target may start a container with no server process. Evidence: "The repository already has tests/ai/mcp/test_mcp_http.py, so the HTTP entrypoint is present."
  4. changed the title [-]feat(k8s): deploy the MCP server manifests when the server entrypoint exists[/-] [+]feat(k8s): deploy MCP server manifests when entrypoint exists[/+] on Nov 6, 2026
  5. dan-petty commented on Nov 6, 2026

    @dan-petty
    Owner

    The job shortened the title of this item. The summary had 65 characters, and the limit is 60. The type and the scope stay.

    • Before: feat(k8s): deploy the MCP server manifests when the server entrypoint exists
    • After: feat(k8s): deploy MCP server manifests when entrypoint exists
    • Source of the summary: the background model
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

    effort/mediumpriority/p2-mediumscope/k8ssource/agentstatus/newtype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions