Skip to content

fix(k8s): push-secrets writes the MCP server bearer token #4354

Closed

Description

@dan-petty

Problem Description

Deployment mcp-server in namespace devops crash-loops since the image is published (release 0.107.0). The pod refuses to start because no bearer token is set. Nothing in the repository creates that token, and nothing gives it to the clients.

Reproduction Steps

  1. Read the pod log of Deployment mcp-server in namespace devops.
  2. Read the key names (not the values) of Secret devops/devops-cli.
  3. Read src/devops_cli/k8s/cluster_secrets.py for a row that holds an MCP token.

Expected vs Actual Behavior

Expected: devops k8s push-secrets writes a generated MCP token to the Secret that the server reads, and the same value to the Secret that the clients read. The pod then starts, and a client can call it.

Actual:

  • The pod log says: "Refusing to start the streamable-http transport: no bearer token is set. Set mcp.token (DEVOPS_CLI_MCP_TOKEN, or devops config set mcp.token)." (src/devops_cli/ai/mcp/remote.py, SECURITY.md "MCP Server on the Network").
  • Secret devops/devops-cli has no key DEVOPS_CLI_MCP_TOKEN.
  • CLUSTER_SECRETS has no row for an MCP token, so push-secrets cannot write it. The Deployment (feat(ai): integrate Jev 1.14 and agent configurations #4275) has no secretKeyRef for it.
  • The clients read other credentials: the stage job reads mcp.stage_token (DEVOPS_CLI_MCP_STAGE_TOKEN) and the implement job reads mcp.implement_token (DEVOPS_CLI_MCP_IMPLEMENT_TOKEN) in src/devops_cli/roadmap/mcp.py. The server accepts one token only, so the three values must be equal. No row writes the two client keys, and configmap.example.yaml sets no roadmap.mcp.url. Both client switches (roadmap.stage.mcp, roadmap.implement.mcp) are off, so no client calls the server yet.

Environment Diagnostics

devops-cli 0.107.0, image ghcr.io/dan-petty/devops-cli/mcp-server, k8s stack devops.

Logs, Traces, or Terminal Output

CrashLoopBackOff, 62 restarts. The one log line is quoted above.

Proposed fix

  • Add Secret devops/mcp-server to CLUSTER_SECRETS, with key DEVOPS_CLI_MCP_TOKEN. The keyring entry is mcp.token, generated (urlsafe, 32 bytes) when it is missing, as for crawl4ai. The row restarts Deployment mcp-server.
  • Add the keys DEVOPS_CLI_MCP_STAGE_TOKEN and DEVOPS_CLI_MCP_IMPLEMENT_TOKEN to the devops-cli row. Both are optional, take the value of mcp.token, and adopt from Secret devops/mcp-server.
  • Wire the Deployment with a secretKeyRef to the new Secret.
  • Set roadmap.mcp.url in configmap.example.yaml, with both switches left off.
  • Update docs/ENV_VARS.md, SECURITY.md and k8s/README.md.

Pre-Submission Checklist

  • I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
  • I have checked existing issues and pull requests to ensure this is not a duplicate.

Activity

  1. added
    source/agent
    type/bug
    scope/k8s
    status/new
    value/medium
    effort/medium
    on Nov 10, 2026
  2. dan-petty commented on Nov 10, 2026

    @dan-petty
    OwnerAuthor

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

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P2-Medium. The pod is in CrashLoopBackOff, but both client switches are off so no user is blocked today.
    • Value: Medium. The MCP server is broken and will block roadmap jobs once the client switches are enabled.
    • Effort: Medium. Requires a new Secret row, two client keys, a secretKeyRef wire, a configmap entry, and three doc updates.
    • Related: feat(k8s): add the Crawl4AI token to the cluster secrets #3882, which asks for a different change. Both add a service token to CLUSTER_SECRETS so push-secrets writes it, but for different services and different key names.
  3. added
    priority/p2-medium
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 10, 2026
  4. removed
    status/in-review
    owner/agent
    on Nov 10, 2026
  5. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor
  6. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-10 13:56 UTC

  7. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Evidence from the cluster telemetry: this cause made the MCP server crash loop, and the fix stopped it. No new issue is necessary.

    • Symptom: Tempo had 89 cli.mcp root spans in 24 hours with the status Exit(exit_code=1). Each lasted about 1.5 s. They came from versions 0.106.1 and 0.107.0.
    • Restarts: kube_pod_container_status_restarts_total reached 12 on pod mcp-server-6d774df98d-p4l94 and 74 on pod mcp-server-796f5f698f-7ff26. kube_pod_container_status_last_terminated_reason was Error for both. No OOMKilled occurred. The probes did not cause the restarts: the process stopped before it opened port 8001.
    • Cause: each start wrote this line to stderr (Loki, {namespace="devops", service_name="mcp-server"} |= "Refusing to start"):
      Refusing to start the streamable-http transport: no bearer token is set. Set mcp.token (DEVOPS_CLI_MCP_TOKEN, or devops config set mcp.token).
    • Window: the first such line is at 2026-11-10T06:28:19Z, after fix(ci): the release publishes the mcp-server image #4334 published the image. The last is at 2026-11-10T13:12:18Z. PR fix(k8s): push-secrets writes the MCP server bearer token #4360 merged at 13:11:46Z, and the Secret push followed.
    • Alert: ArgoCdApplicationUnhealthy fired for the devops application (health Degraded) during the full window. The application became Healthy after 13:12Z.
    • Now: pod mcp-server-685c696659-5kr4t runs since 2026-11-11T01:25:53Z with 0 restarts.
    • Guard: test_every_secret_key_that_a_manifest_reads_from_a_table_secret_is_a_table_entry (tests/invariants/test_k8s_manifests.py) fails if a manifest reads a key that devops k8s push-secrets does not write.
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/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions