Skip to content

[Kubernetes Operator] Unable to pass env vars to container #520

@rubenharutyunov

Description

@rubenharutyunov

I have the following MCPServer resource:

apiVersion: toolhive.stacklok.dev/v1alpha1
kind: MCPServer
metadata:
  name: grafana
  namespace: grafana-mcp
spec:
  image: docker.io/mcp/grafana
  transport: stdio
  port: 8000
  env:
    - value: grafana.example.com
      name: GRAFANA_URL
  permissionProfile:
    type: builtin
    name: network
  resources:
    limits:
      cpu: "20m"
      memory: "64Mi"
    requests:
      cpu: "10m"
      memory: "32Mi"

Based on examples I see in this repo, the operator should pass the env vars defined in the manifest into the mcp server pod it creates, however I see them set only in the runner pod. Here's what I see in k describe pod grafana-0:

Containers:
  mcp:
    Container ID:  docker://554e935eb935ec6527cbebeff8ca6f7a5c6f00ecdb1213cf0499eafc3f267575
    Image:         docker.io/mcp/grafana
    Port:          <none>
    Host Port:     <none>
    Args:
      --transport
      stdio
    State:          Running
      Started:      Fri, 30 May 2025 15:48:39 +0200
    Ready:          True
    Restart Count:  0
    Environment:
      MCP_TRANSPORT:  stdio
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-gb5hv (ro)

I'm running the latest dev versions: 0.0.1-dev.400_bcba31b

Metadata

Metadata

Assignees

Labels

area/kubernetes/deployment-and-lifecycleIssues relating to ToolHive deployment and lifecycle inside of KuberneteskubernetesItems related to Kubernetesp0High

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions