AI automation · Platform engineering

n8n + MCP on Kubernetes: production architecture patterns

Architecture guide · updated September 2026

n8n can orchestrate workflow steps, MCP can expose tools and context to AI-enabled clients, and Kubernetes can provide a deployment and operating substrate. The production question is how to connect those roles without collapsing identity, data, tool permissions and human judgment into one undifferentiated automation layer.

Architecture boundary: this article describes patterns, not one mandatory stack and not a claim about Tayoca’s private infrastructure. Validate versions, transports, operators and deployment choices against the software you actually run.

1. Give each layer one clear job

n8n

Workflow orchestration, schedules, webhooks, branching, retries and integration logic.

MCP servers

Bounded interfaces that expose tools, resources or prompts to authorized clients.

Kubernetes

Scheduling, workload isolation, service discovery, rollout, policy and runtime operations.

External systems

Databases, SaaS APIs, repositories and business systems whose own authorization boundaries still apply.

Keeping those roles explicit prevents a useful automation framework from quietly becoming an unrestricted control plane.

2. Choose execution topology from workload behavior

A small internal workflow service may need only one n8n instance and durable database storage. Higher concurrency, long-running jobs or availability requirements can justify queue-backed workers and separate execution capacity. Choose the topology from measured workload needs instead of copying a “production” diagram.

QuestionWhy it matters
How many concurrent executions exist?Influences worker count, queueing, CPU/memory and database connection pressure.
How long can a workflow run?Affects timeouts, retries, idempotency and whether a durable workflow engine is a better fit for some jobs.
What state must survive a Pod replacement?Determines database, object-storage or volume requirements.
Which actions are safe to retry?Prevents duplicate purchases, messages, tickets or mutations after transient failures.
What must remain available during maintenance?Drives replica, rollout and disruption decisions.

3. Treat MCP servers as trust boundaries

An MCP server that can read a repository is different from one that can merge code, mutate infrastructure or send customer messages. Deploy and authorize them accordingly.

4. Keep secrets out of workflow exports and manifests

Credentials should come from an approved secret-management path, not Git, hard-coded workflow JSON or copied environment files. Kubernetes Secrets may be the delivery object, while an external secret manager, encrypted Git workflow or platform-native identity handles the source of truth.

Rotation matters as much as storage. Test whether a credential can be changed or revoked without manually rebuilding every workflow.

5. Network the system by capability

Use ClusterIP-style internal services for components that do not need public exposure. Put external ingress only in front of the endpoints that require it. NetworkPolicy is useful when the CNI enforces it, but policy should reflect actual dependencies: DNS, database, queue, selected MCP services and required external APIs.

A workflow runner that can reach every internal service and every external API by default has a larger blast radius than most automations need.

6. Build observability around the workflow, not only Pods

Pod CPU and restart counts are necessary but insufficient. Instrument the automation outcome.

Execution health

Success/failure rate, duration, retry count, queue depth and oldest waiting job.

Dependency health

Database latency, upstream API failures, MCP tool errors and authentication failures.

AI behavior

Model latency, token or infrastructure usage, evaluation signals, retrieval quality and fallback behavior where AI is involved.

Business outcome

Whether the intended ticket, notification, reconciliation or handoff actually happened.

7. Design retries and idempotency before scaling

Distributed automation fails partially. A webhook may arrive twice. A worker can crash after an external API accepts the request but before the workflow records success. Build idempotency keys, deduplication, state transitions and compensation where the business action requires them.

Operational rule: “retry on error” is safe only when repeating the action is safe or the workflow can prove the action has not already succeeded.

8. Use GitOps for deployment, not secret or workflow theatre

Helm, Kustomize or another declarative packaging approach can version the platform configuration. CI can render and validate manifests; a GitOps controller can reconcile reviewed desired state. Keep runtime credentials outside plaintext Git and document how emergency operational changes interact with reconciliation.

git change
  → render / validate
  → review
  → merge desired state
  → GitOps reconciliation
  → health and workflow-level verification

9. Preserve a human boundary for material actions

AI-enabled automation is most useful when routine work can move quickly while consequential actions remain accountable. Examples that often justify approval or stronger policy include production infrastructure mutation, financial transactions, destructive data changes, external publication, customer-impacting account actions and security-sensitive credential changes.

The boundary should be encoded in the workflow or authorization layer rather than left as a tribal expectation.

10. Model cost as a workload equation

There is no universal “self-hosted wins” number. Compare the costs that apply to your workload: compute, database, queue/cache, storage, ingress/egress, observability, backups, engineering time and operational risk. Then divide by a useful business unit such as successful workflow executions or automated cases handled.

A managed service can be economically better at one scale and self-hosting can be better at another. The decision changes with workload, labor, compliance, control and reliability requirements.

Production validation checklist

Build the pattern hands-on

The n8n + MCP Kubernetes Teaching Pack packages the architecture into guided implementation material for operators. For teams that need a broader automation or platform engagement, review Tayoca’s services separately rather than assuming one fixed implementation scope fits every environment.