Repository navigation
Description
Problem
Tools of the role planning of the deployed MCP server fail in the pod, because the server lacks the settings that they read. A client gets an error text and no data. The roadmap jobs use the same role endpoint.
Evidence
Read on 2026-11-26 at 22:25Z with an MCP client in the namespace llm (/planning/mcp, bearer value of the server, 28 tools listed, each with the read-only hint):
| Tool | Result |
|---|---|
gh_rate_limit |
data |
telemetry_status |
data |
k8s_status |
Failed to query cluster: Kubernetes client configuration is not available. |
k8s_pods (namespace llm) |
a table with one row Error: Kubernet... |
argo_cd_apps_list |
ArgoCD URL not configured. Run: devops config set argocd.url <url> |
grafana_dashboards_list |
Grafana URL not configured. Run: devops config set grafana.url <url> |
The Deployment mcp-server sets a kube context name in its environment and mounts the ConfigMap of the stack. The pod holds no kubeconfig file, and the in-cluster service account is not used by the Kubernetes tools.
Acceptance criteria
- In the deployed pod, each tool of the role tables either gives data or is not in the table. The record lists the 28 tools of
planningwith the result of one call each. - The Kubernetes tools use the service account of the pod when no kubeconfig exists, with a Role that gives the read verbs that the tools need and no more.
- The Argo CD and Grafana tools read their URLs from the ConfigMap of the stack, and their bearer values from a Secret row, or they leave the role tables.
- A check in the cluster (a Job or a probe run) calls one tool of each group and fails when a tool gives a settings error.
Alternatives check of 2026-11-26: in-use.
The repository already uses this tool.
Tool: kubernetes (https://pypi.org/project/kubernetes), Apache-2.0, last activity 2026-11-18, maintained.
Reason: Searches found no dedicated MCP cluster-settings tool; the Kubernetes Python client covers in-cluster service-account auth only, leaving Argo CD/Grafana settings, Secret wiring and the probe as project work.
Covers:
- In-cluster service-account authentication via load_incluster_config
- Kubernetes API reads for status, pods and namespaced resources
- Namespaced Role with only get, list and watch
Lacks:
- Argo CD and Grafana URL and bearer-value settings
- MCP probe that calls one tool of each group
- Deployment, ConfigMap and Secret wiring for the server
Proposed design
Problem statement
The planning role of the deployed MCP server returns settings errors for its Kubernetes, Argo CD and Grafana tools. The pod runs in namespace devops and holds no kubeconfig file, no service-account token and no API server egress. The pod also holds no Argo CD or Grafana URL and no bearer value. This change gives the server a dedicated ServiceAccount, a read-only ClusterRole, API server egress, and the URL and bearer settings. It adds a check that fails on a settings error.
Acceptance criteria
Requirement: Dedicated service account
The mcp-server Deployment SHALL use a dedicated ServiceAccount in namespace devops with automountServiceAccountToken: true.
Scenario: Manifest check
- WHEN The change runs
uv run devops ci --check --only k8son the Deployment and ServiceAccount manifests. - THEN The check exits 0.
Requirement: Read-only cluster role
The ClusterRole of the mcp-server ServiceAccount SHALL grant only get, list and watch on nodes and pods.
Scenario: Manifest check
- WHEN The change runs
uv run devops ci --check --only k8son the ClusterRole and ClusterRoleBinding manifests. - THEN The check exits 0.
Requirement: API server egress
The NetworkPolicy of mcp-server SHALL allow TCP 6443 egress to the Kubernetes API server.
Scenario: Manifest check
- WHEN The change runs
uv run devops ci --check --only k8sonk8s/devops/networkpolicy.yaml. - THEN The check exits 0.
Requirement: Argo CD and Grafana settings
The mcp-server Deployment SHALL set the Argo CD and Grafana URL settings from the stack ConfigMap and their bearer values from the Secret that devops k8s push-secrets writes, and SHALL NOT use an ExternalSecret for these values.
Scenario: Manifest check
- WHEN The change runs
uv run devops ci --check --only k8son the Deployment manifest. - THEN The check exits 0.
Requirement: Cluster tool probe
The command devops k8s mcp-server-check SHALL call k8s_status, k8s_pods, argo_cd_apps_list and grafana_dashboards_list, and exit non-zero when one gives a settings error.
Scenario: Settings error
- WHEN A test gives the check a settings error for
grafana_dashboards_listand data for the other three tools. - THEN The check exits non-zero and prints the tool name and the error text.
Requirement: Cluster tool probe passes
The command devops k8s mcp-server-check SHALL exit 0 when each of the four tools returns data.
Scenario: All tools return data
- WHEN A test gives the check data for
k8s_status,k8s_pods,argo_cd_apps_listandgrafana_dashboards_list. - THEN The check exits 0 and prints one line for each tool.
Requirement: Read-only service account
The command devops k8s mcp-server-check MUST exit non-zero when the service account of the pod can delete a pod in the devops namespace.
Scenario: Delete allowed
- WHEN A test gives the check a fake authorization client that allows
deleteonpods. - THEN The check exits non-zero and prints
deleteandpods.
Requirement: Forbidden read names the permission
The command devops k8s mcp-server-check MUST exit non-zero and name the verb and the resource when a tool gets a forbidden error.
Scenario: Forbidden read
- WHEN A test gives the check a tool result of
Forbidden: cannot list resource "nodes". - THEN The check exits non-zero and prints
listandnodes.
Requirement: Pending a person after the merge
The post-merge record MUST list one call to each of the 28 tools of the planning role after a person sets the bearer values and runs the cluster check.
Scenario: Planning role record
- WHEN A person sets the Argo CD and Grafana bearer values in the keyring, runs
uv run devops k8s push-secrets, runsuv run devops k8s mcp-server-check, and calls each of the 28 tools after the merge. - THEN The check exits 0, and the issue holds a table with one row for each of the 28 tools, and each row shows data or that the tool is not in the table.
Existing Tool Considered
The alternatives check in the issue body gives kubernetes (https://pypi.org/project/kubernetes) the verdict in-use, because the repository already uses it. Its Covers: and Lacks: lists hold what the tool gives and misses. This proposal does the lacks with project work. The stack ConfigMap holds the two URLs. The Secret that devops k8s push-secrets writes holds the bearer values. A dedicated ServiceAccount and ClusterRole wire the server. The devops k8s mcp-server-check command calls one tool of each group. The command costs about 2k tokens and one hour to build, keep and fix.
Key questions
- In which namespace does the
mcp-serverDeployment run?: Themcp-serverDeployment runs in namespacedevops. The folderk8s/llm/does not exist after refactor(k8s): delete the environment files from devops-cli #7317. [sources: k8s/devops/mcp-server/deployment.yaml, k8s/devops/networkpolicy.yaml] - Which Kubernetes authentication do the tools use when no kubeconfig file exists?: The existing
KubernetesClientSource.connectfalls back toInClusterConfigLoaderwhen no kubeconfig context matches. The change enables the token on a dedicated ServiceAccount and adds no authentication code. (best practice) [sources: src/devops_cli/k8s/api.py:167-222, k8s/devops/mcp-server/deployment.yaml]- Chosen: In-cluster service account. The pod holds a service account and no kubeconfig file. The client needs no long-lived file.
- Rejected: Mounted kubeconfig Secret. It adds a long-lived credential file and a Secret to rotate.
- Rejected: Exec credential plugin. The pod holds no external identity provider.
- Should the Kubernetes access use a namespaced Role or a ClusterRole?: Use a dedicated ServiceAccount and a ClusterRole with only
get,listandwatchonnodesandpods. A namespaced Role cannot grantliston the cluster-scopednodesthatk8s_statusreads or the cross-namespace pod list thatk8s_podsuses. (best practice) [sources: src/devops_cli/k8s/service.py:307-316, src/devops_cli/k8s/api.py, k8s/devops/mcp-server/deployment.yaml]- Chosen: ClusterRole on nodes and pods. It grants the cluster-scoped node read and the cross-namespace pod read that the tools need, with only read verbs.
- Rejected: Namespaced Role. It cannot grant
liston the cluster-scopednodesor the cross-namespace pod list. - Rejected: Shared ServiceAccount
devops-cli. It hasautomountServiceAccountToken: falseand other pods use it.
- How do the Argo CD and Grafana tools receive their URL and bearer value in the pod?: The URLs come from the stack ConfigMap. The bearer values come from the Secret that
devops k8s push-secretswrites, as ADR 0033 requires for platform Secrets. The Deployment gives each value to the server in an environment variable. No bearer value goes into the ConfigMap or into git. (best practice) [sources: docs/adr/0033-service-secrets-come-from-external-secrets-operator.md:37-38, SECURITY.md, k8s/devops/mcp-server/deployment.yaml, src/devops_cli/argo/credentials.py, src/devops_cli/commands/grafana.py]- Chosen: URL from the ConfigMap and bearer value from the push-secrets Secret. The stack already holds the URLs. The Secret keeps the bearer values out of git and out of the ConfigMap, and ADR 0033 requires this method for platform Secrets.
- Rejected: ExternalSecret for the bearer values. ADR 0033 uses
devops k8s push-secretsfor platform Secrets, not an ExternalSecret. - Rejected: URL and bearer value in the ConfigMap. It puts a secret in a ConfigMap and in git, which SECURITY.md forbids.
- Does the
mcp-serverNetworkPolicy allow TCP 6443 egress to the Kubernetes API server?: No.k8s/devops/networkpolicy.yamlhas no TCP 6443 egress. The change adds an egress rule to the Kubernetes API server. [sources: k8s/devops/networkpolicy.yaml] - Should the cluster check be a Job, a readiness probe or a
devops k8scheck command?: Use adevops k8s mcp-server-checkcommand, in the form of the existingdevops k8s searxng-checkanddevops k8s crawl4ai-checkcommands. Do not use a readiness probe, because a settings error would restart the pod and hide the result. (best practice) [sources: tests/commands/k8s/test_k8s_searxng_check.py, tests/commands/k8s/test_k8s_crawl4ai_check.py, tests/commands/k8s/test_k8s_probe.py]- Chosen:
devops k8s mcp-server-checkcommand. It follows the existing check commands, calls each tool group and prints one result for each. - Rejected: Readiness probe. A settings error would restart the pod and hide the tool result.
- Rejected: One-off Job. It needs a new manifest and shares no command with the existing cluster checks.
- Chosen:
- Does the
planningrole table already name the Argo CD and Grafana tools?: Yes. Theplanningrole lists 28 tools, andargo_cd_apps_listandgrafana_dashboards_listare two of them. [sources: src/devops_cli/roadmap/tools.py, src/devops_cli/ai/tools/registry.py:107, docs/MCP_TOOLS.md, tests/ai/mcp/test_mcp_roles.py] - Which Secret method does ADR 0033 require for the platform Secrets?: ADR 0033 requires
devops k8s push-secretsfor platform Secrets. An ExternalSecret is for service Secrets, not for these platform Secrets. [sources: docs/adr/0033-service-secrets-come-from-external-secrets-operator.md:37-38, SECURITY.md]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 26, 2026
Cluster tools return errors in the live pod and the roadmap jobs that use this endpoint get incomplete data, causing increased error rates.Both concern the MCP server deployment in k8s, but #3600 adds the manifests while the candidate fixes the tool settings inside the running pod.devops-cli-service commentedon Nov 26, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.
devops-cli-service commentedon Nov 26, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (3)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 27, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
10 remaining items
chore(main): release 0.237.0 (#7611)
devops-cli-service commentedon Nov 28, 2026
Released in v0.237.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.237.0
devops-cli-service commentedon Nov 28, 2026
Live since 2026-11-28 18:38 UTC