Skip to content

[Gap]: Document the operator's default read-only root filesystem for MCP server pods #1080

Description

@danbarr

What needs documentation?

The ToolHive Kubernetes operator applies readOnlyRootFilesystem: true by default to the mcp container in MCPServer-managed pods (it only skips this if the user's podTemplateSpec already sets the field explicitly). This default isn't documented anywhere on the site. The Kubernetes operator quickstart now mentions it in passing (as the reason the toolhive-docs.yaml example mounts an emptyDir volume at /tmp), but that's the only place it's asserted, and it's not backed up by the reference guide where podTemplateSpec is actually explained.

Context and references

Confirmed in the operator source:

  • pkg/container/kubernetes/security.go, BuildContainerSecurityContext() sets ReadOnlyRootFilesystem: ptr.To(true) unconditionally, to satisfy the restricted Pod Security Standard.
  • pkg/container/kubernetes/client.go, configureContainer() applies that default specifically to the container named mcp, filling in the field only when it's not already set in the user's pod template.
  • Reached via cmd/thv-operator/controllers/mcpserver_controller.go, which is the control path for the MCPServer CRD.

Relevant doc: docs/toolhive/guides-k8s/run-mcp-k8s.mdx, "Customize the MCP server pod" / "Mount a volume" sections, where podTemplateSpec is documented.

Use case

MCP server images that write to disk (temp files, caches, SQLite databases, etc.) will fail at runtime with a read-only filesystem error unless the user proactively mounts a writable volume (typically emptyDir) via podTemplateSpec. Right now there's no way to know this default exists until you hit that error. Documenting it up front in the reference guide would let readers plan for it instead of debugging it after deployment.

Additional context

Suggest adding a short note near the existing "Mount a volume" section in run-mcp-k8s.mdx describing the default and the emptyDir workaround, with a mention that the field can be overridden explicitly in podTemplateSpec for images that require a writable root filesystem (not recommended, but possible).

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssue needs initial triage by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions