Files
claudeandClaude Opus 5.5 7bf9f6022c Add cluster-internal MCP servers for the LocalAI agent pool
Gitea, Grafana, Nextcloud and Discourse MCP servers as ClusterIP-only
Deployments in namespace mcp, read-only, acting as LDAP user localai.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 12:38:15 -05:00

91 lines
2.6 KiB
YAML

#SPDX-License-Identifier: MIT-0
---
# tasks file for ansible-role-mcp-servers
- name: Create namespace for MCP servers
k8s:
state: present
definition:
apiVersion: v1
kind: Namespace
metadata:
name: "{{ mcp_namespace }}"
- name: Deploy MCP servers
k8s:
state: present
definition:
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ item.name }}"
namespace: "{{ mcp_namespace }}"
spec:
replicas: 1
selector:
matchLabels:
app: "{{ item.name }}"
template:
metadata:
labels:
app: "{{ item.name }}"
spec:
automountServiceAccountToken: false
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
seccompProfile:
type: RuntimeDefault
containers:
- name: "{{ item.name }}"
image: "{{ item.image }}"
command: "{{ item.command | default(omit) }}"
args: "{{ item.args | default(omit) }}"
env: "{{ item.env | default([]) }}"
envFrom: "{{ item.envFrom | default([]) }}"
ports:
- name: http
containerPort: 8000
readinessProbe:
tcpSocket:
port: http
initialDelaySeconds: 5
periodSeconds: 10
resources:
requests:
cpu: 10m
memory: 64Mi
limits:
memory: "{{ item.memory | default('256Mi') }}"
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: [ALL]
volumeMounts: "{{ [{'name': 'tmp', 'mountPath': '/tmp'}] + (item.mounts | default([])) }}"
volumes: "{{ [{'name': 'tmp', 'emptyDir': {}}] + (item.volumes | default([])) }}"
loop: "{{ mcp_servers }}"
loop_control:
label: "{{ item.name }}"
- name: Create ClusterIP services for MCP servers (no ingress)
k8s:
state: present
definition:
apiVersion: v1
kind: Service
metadata:
name: "{{ item.name }}"
namespace: "{{ mcp_namespace }}"
spec:
type: ClusterIP
selector:
app: "{{ item.name }}"
ports:
- name: http
port: 8000
targetPort: http
loop: "{{ mcp_servers }}"
loop_control:
label: "{{ item.name }}"