Skip to content

Minimal manifests

This is the smallest set that runs Turf™ in a cluster, everything in one namespace, turf. It is written from two examples: turf-kagent’s Kustomize manifests and the plain-kubectl manifests that turf-examples’ integrations/kagent carried before that example moved to turf-kagent. Six parts, applied in this order:

  1. the namespace and three Secrets;
  2. the CLI configuration, one ConfigMap;
  3. restate-server and the engine, either as a StatefulSet and a Deployment or through the Restate operator and Knative;
  4. the MCP server;
  5. the console;
  6. NetworkPolicy for each part.

The configuration is the configuration image ghcr.io/turfbuild/turf-examples/kubernetes-in-cluster (a namespace and a ConfigMap), mounted read-only at /turf/config in the server’s pod and every engine pod. Substitute your own. State goes in the Kubernetes® state backend, in turf.

Each Turf container checks that the license terms are accepted before it does its work, and in a pod it reads only its own environment, or the --accept-eula flag. The manifests below carry the entry commented out in the env: of the engine, the server and the console:

env:
# - name: TURF_ACCEPT_EULA
# value: "yes"

Uncommenting it is your acceptance of the terms at turf.build/license/v1, so read them first. Without it:

  • the engine and the console print the license notice and exit with status 77, and their pods go to CrashLoopBackOff;
  • the server starts and lists its tools, and every call returns the notice.

Who uses Turf free, and who needs a commercial license, is at turf.build/licensing.

Three Secrets: the engine’s identity key pair, the server’s bearer token and the console’s token. The engine makes its own key pair.

Terminal window
kubectl create namespace turf
mkdir -p .secrets && chmod 700 .secrets
# identity.pem: the private half, which restate-server signs every request to the engine with.
# public-key: the public half, which the engine checks every request against.
docker run --rm --user "$(id -u)" -v "$PWD/.secrets:/k" ghcr.io/turfbuild/turf-mcp-server:v1.5.0 \
turf-engine --identity-keygen /k/identity.pem > .secrets/public-key
# No trailing newline: the server refuses a token with whitespace in it.
(umask 077 && openssl rand -hex 32 | tr -d '\n' > .secrets/mcp-token)
(umask 077 && openssl rand -hex 32 | tr -d '\n' > .secrets/console-token)
kubectl -n turf create secret generic turf-engine-identity \
--from-file=identity.pem=.secrets/identity.pem --from-file=public-key=.secrets/public-key
kubectl -n turf create secret generic turf-mcp-auth --from-file=token=.secrets/mcp-token
kubectl -n turf create secret generic turf-console-auth --from-file=token=.secrets/console-token

Adapted from turf-kagent’s setup/secrets.sh. Keep .secrets/ out of version control. restate-server, the engine and the server read their Secrets only at start, so restart them after changing one.

One OpenTofu® CLI configuration for every Turf pod, mounted at /turf/cli and named by TF_CLI_CONFIG_FILE. Its provider_installation block says where provider plugins come from; the server and the engine must read the same block. As shipped it is the registry:

apiVersion: v1
kind: ConfigMap
metadata:
name: turf-cli-config
namespace: turf
data:
turf.tfrc: |
provider_installation {
direct {}
}

The same in both examples (cli-config.yaml, turf-cli-config.yaml). Mirrors and registry tokens are in Credentials in a cluster.

Pick one. A StatefulSet and a Deployment need no operator. The Restate operator and Knative scale the engine from zero and version it for you.

restate-server, one node, its data on a PersistentVolume:

apiVersion: v1
kind: Service
metadata:
name: restate
namespace: turf
spec:
selector:
app: restate
ports:
- name: ingress
port: 8080
- name: admin
port: 9070
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: restate
namespace: turf
spec:
serviceName: restate
replicas: 1
selector:
matchLabels:
app: restate
template:
metadata:
labels:
app: restate
spec:
containers:
- name: restate
image: docker.io/restatedev/restate:1.8.1
env:
- name: RESTATE_BASE_DIR
value: /restate-data
# restate-server's own telemetry, which Turf's local engine also turns off.
- name: RESTATE_DISABLE_TELEMETRY
value: "true"
# One-way: this node's data cannot go back to a release before 1.8.1.
- name: RESTATE_EXPERIMENTAL_ENABLE_PREFLIGHT_SIGNAL_RECORDING
value: "true"
# Fixed when the node first provisions.
- name: RESTATE_DEFAULT_NUM_PARTITIONS
value: "8"
- name: RESTATE_WORKER__INVOKER__REQUEST_IDENTITY_PRIVATE_KEY_PEM_FILE
value: /identity/identity.pem
ports:
- name: ingress
containerPort: 8080
- name: admin
containerPort: 9070
volumeMounts:
- name: restate-data
mountPath: /restate-data
- name: identity
mountPath: /identity
readOnly: true
volumes:
# The private key alone; the engine gets only the public half.
- name: identity
secret:
secretName: turf-engine-identity
defaultMode: 0400
items:
- key: identity.pem
path: identity.pem
volumeClaimTemplates:
- metadata:
name: restate-data
spec:
accessModes: [ReadWriteOnce]
resources:
requests:
storage: 10Gi

Adapted from turf-examples’ restate.yaml, which also carries the three options only a 1.7 node needs.

The engine, two replicas that register themselves with restate-server at start:

apiVersion: v1
kind: ServiceAccount
metadata:
name: turf-engine
namespace: turf
---
apiVersion: v1
kind: Service
metadata:
name: turf-engine
namespace: turf
spec:
selector:
app: turf-engine
ports:
- name: restate
port: 9080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: turf-engine
namespace: turf
spec:
replicas: 2
# Roll together, so no two replicas serve different releases or configuration images.
strategy:
type: Recreate
selector:
matchLabels:
app: turf-engine
template:
metadata:
labels:
app: turf-engine
spec:
serviceAccountName: turf-engine
containers:
- name: turf-engine
# The same tag as the server and the console.
image: ghcr.io/turfbuild/turf-mcp-server:v1.5.0
command: ["/turf-engine"]
args:
- --addr=0.0.0.0:9080
- --advertise=http://turf-engine.turf.svc:9080
- --admin-addr=http://restate.turf.svc:9070
- --plugin-cache-dir=/turf/plugins
- --data-dir=/turf/data
env:
# Uncomment to accept the Turf license terms at https://turf.build/license/v1/.
# Setting it accepts them. Without it the engine exits with status 77.
# - name: TURF_ACCEPT_EULA
# value: "yes"
- name: TURF_ENGINE_IDENTITY_KEYS
valueFrom:
secretKeyRef:
name: turf-engine-identity
key: public-key
- name: TF_CLI_CONFIG_FILE
value: /turf/cli/turf.tfrc
# The providers' credentials (Credentials in a cluster).
envFrom:
- secretRef:
name: turf-provider-credentials
optional: true
ports:
- name: restate
containerPort: 9080
volumeMounts:
- name: configuration
mountPath: /turf/config
readOnly: true
- name: data
mountPath: /turf/data
- name: plugins
mountPath: /turf/plugins
- name: cli-config
mountPath: /turf/cli
readOnly: true
volumes:
- name: configuration
image:
reference: ghcr.io/turfbuild/turf-examples/kubernetes-in-cluster:1.0.0
pullPolicy: IfNotPresent
# Each replica's own caches. A restart empties them, and the replica installs
# modules and providers again the next time a round's step lands on it.
- name: data
emptyDir: {}
- name: plugins
emptyDir: {}
- name: cli-config
configMap:
name: turf-cli-config

Adapted from turf-examples’ turf-engine.yaml (Turf 1.2.0 there; the provider Secret renamed).

NetworkPolicy for the two. restate-server has no authentication of its own, so its policy decides who reaches it:

# restate-server: the ingress for the MCP server and the console, the admin API for the
# engine. It dials only the engine, and DNS.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: restate
namespace: turf
spec:
podSelector:
matchLabels:
app: restate
policyTypes: [Ingress, Egress]
ingress:
- from:
- podSelector:
matchLabels:
app: turf-mcp-server
- podSelector:
matchLabels:
app: turf-console
ports:
- port: 8080
- from:
- podSelector:
matchLabels:
app: turf-engine
ports:
- port: 9070
egress:
- to:
- podSelector:
matchLabels:
app: turf-engine
ports:
- port: 9080
- to:
- namespaceSelector: {}
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP
---
# The engine: restate-server alone. Its egress stays open: provider plugins reach the
# APIs and registries a configuration names.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: turf-engine
namespace: turf
spec:
podSelector:
matchLabels:
app: turf-engine
policyTypes: [Ingress]
ingress:
- from:
- podSelector:
matchLabels:
app: restate
ports:
- port: 9080

Adapted from turf-examples’ networkpolicy.yaml, with the console admitted to the ingress as turf-kagent admits it.

A Deployment and a Service on port 3000, its ServiceAccount allowed the Kubernetes state backend’s two objects and nothing else:

apiVersion: v1
kind: ServiceAccount
metadata:
name: turf-mcp-server
namespace: turf
---
# The kubernetes state backend's rights: Secrets and Leases in this namespace.
# The server never runs a provider, so it needs nothing else.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: turf-state
namespace: turf
rules:
- apiGroups: [""]
resources: [secrets]
verbs: [get, list, watch, create, update, patch, delete]
- apiGroups: [coordination.k8s.io]
resources: [leases]
verbs: [get, list, watch, create, update, patch, delete]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: turf-mcp-server-state
namespace: turf
subjects:
- kind: ServiceAccount
name: turf-mcp-server
namespace: turf
roleRef:
kind: Role
name: turf-state
apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: Service
metadata:
name: turf-mcp-server
namespace: turf
spec:
selector:
app: turf-mcp-server
ports:
- name: mcp
port: 3000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: turf-mcp-server
namespace: turf
spec:
replicas: 1
selector:
matchLabels:
app: turf-mcp-server
template:
metadata:
labels:
app: turf-mcp-server
spec:
serviceAccountName: turf-mcp-server
containers:
- name: turf-mcp-server
image: ghcr.io/turfbuild/turf-mcp-server:v1.5.0
args:
- --transport=http
- --addr=:3000
- --tmp-dir=/turf/tmp
- --plugin-cache-dir=/turf/plugins
env:
# Uncomment to accept the Turf license terms at https://turf.build/license/v1/.
# Setting it accepts them. Without it every call returns the license notice.
# - name: TURF_ACCEPT_EULA
# value: "yes"
# Every request must carry "Authorization: Bearer <token>"; anything else gets 401.
- name: TURF_MCP_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: turf-mcp-auth
key: token
# The engine: restate-server's ingress.
- name: TURF_RESTATE_URL
value: http://restate.turf.svc:8080
# Where a browser reaches the console: here, through a port-forward.
- name: TURF_CONSOLE_URL
value: http://localhost:8873
# Where init's module install goes: the configuration is read-only.
- name: TF_DATA_DIR
value: /turf/data
- name: TF_CLI_CONFIG_FILE
value: /turf/cli/turf.tfrc
ports:
- name: mcp
containerPort: 3000
readinessProbe:
tcpSocket:
port: mcp
volumeMounts:
# The same path as in the engine's pods, so no --workdir is needed.
- name: configuration
mountPath: /turf/config
readOnly: true
- name: data
mountPath: /turf/data
- name: plugins
mountPath: /turf/plugins
- name: tmp
mountPath: /turf/tmp
- name: cli-config
mountPath: /turf/cli
readOnly: true
volumes:
- name: configuration
image:
reference: ghcr.io/turfbuild/turf-examples/kubernetes-in-cluster:1.0.0
pullPolicy: IfNotPresent
- name: data
emptyDir: {}
- name: plugins
emptyDir: {}
- name: tmp
emptyDir: {}
- name: cli-config
configMap:
name: turf-cli-config
---
# Your MCP clients, on 3000. Its egress stays open: it reaches the provider registry,
# restate-server's ingress and the API server (the state backend).
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: turf-mcp-server
namespace: turf
spec:
podSelector:
matchLabels:
app: turf-mcp-server
policyTypes: [Ingress]
ingress:
- from:
# Replace with your clients' namespace and pod labels.
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: my-agents
podSelector:
matchLabels:
app: my-agent
ports:
- port: 3000

Adapted from turf-kagent’s mcp-server.yaml and network-policies.yaml, where the peers are kagent’s controller and its egress gateway, and the Role and its binding are in a namespace that holds only state, kagent-tfstate. (turf-examples ran the server as a kagent MCPServer resource rather than a Deployment.) For a backend other than the Kubernetes one, leave out the Role and its binding and give the server that backend’s credentials instead.

turf-ui from the same image, behind its token. No pod in the cluster may reach it: the way in is a port-forward.

apiVersion: v1
kind: Service
metadata:
name: turf-console
namespace: turf
spec:
selector:
app: turf-console
ports:
- name: http
port: 8873
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: turf-console
namespace: turf
spec:
replicas: 1
selector:
matchLabels:
app: turf-console
template:
metadata:
labels:
app: turf-console
spec:
automountServiceAccountToken: false
containers:
- name: turf-ui
image: ghcr.io/turfbuild/turf-mcp-server:v1.5.0
command: ["/turf-ui"]
args:
- --addr=0.0.0.0:8873
- --ingress-addr=http://restate.turf.svc:8080
# Must match the engine's (on, its default).
- --scopes=on
env:
# Uncomment to accept the Turf license terms at https://turf.build/license/v1/.
# Setting it accepts them. Without it the console exits with status 77.
# - name: TURF_ACCEPT_EULA
# value: "yes"
- name: TURF_CONSOLE_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: turf-console-auth
key: token
ports:
- name: http
containerPort: 8873
readinessProbe:
httpGet:
path: /api/health
port: http
securityContext:
readOnlyRootFilesystem: true
---
# Nothing in the cluster. A port-forward goes past the network plugin, so it is the one way in.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: turf-console
namespace: turf
spec:
podSelector:
matchLabels:
app: turf-console
policyTypes: [Ingress]
ingress: []

From turf-kagent’s console.yaml and network-policies.yaml. More in The console in a cluster.

Apply restate-server first and wait for it: the engine checks its version at start, and the operator registers the engine with it. Then everything else.

Terminal window
# A StatefulSet:
kubectl rollout status statefulset/restate -n turf --timeout=300s
# A RestateCluster:
kubectl wait --for=condition=Ready --timeout=300s restatecluster/turf
kubectl rollout status statefulset/restate -n turf --timeout=300s

A turf-engine or turf-console pod in CrashLoopBackOff with exit code 77 is waiting for the license: kubectl logs shows the notice.

Then check that the server refuses a request without its token, through a port-forward:

Terminal window
kubectl port-forward -n turf svc/turf-mcp-server 3000
curl -s -o /dev/null -w '%{http_code}\n' -X POST http://127.0.0.1:3000/mcp # 401

NetworkPolicy is enforced by the cluster’s network plugin, not by Kubernetes: on a CNI that ignores it, the policies are accepted and do nothing (kind’s kindnet enforces them). They work at layers 3 and 4 only, which is why the server still checks its token and the engine still checks that restate-server signed every request.

The turf-kagent manifests also give every container resource requests and limits and a restricted securityContext: user 1000, non-root, no privilege escalation, every capability dropped, the runtime’s default seccomp profile. Keep them.

Turf™ is a trademark of Turf LLC. Terraform® is a trademark of HashiCorp. Ansible® is a trademark of Red Hat, LLC, registered in the United States and other countries. Helm®, Kubernetes®, Prometheus® and OpenTelemetry® are registered trademarks, and Jaeger™ is a trademark, of the Linux Foundation. OpenTofu® and Model Context Protocol® are registered trademarks of LF Projects, LLC. All other trademarks are the property of their respective owners. Turf is not affiliated with, endorsed by, or sponsored by HashiCorp, IBM, Red Hat, the Linux Foundation, LF Projects or the OpenTofu project.

© 2026 Turf LLC. Free for individuals, education and small businesses within the Community limits, under the Turf Community Edition License 1.0. Government and larger organizations need a commerciallicense.turf.build · Discord ·GitHub