infrapuzzle/k8s/n8n/garmin-mcp.yaml

90 lines
2.6 KiB
YAML

# --- 1. Secret to hold your Garmin Connect token ---
# You must create this secret before applying the rest of the manifest.
# Replace 'your_base64_encoded_token_here' with your actual token encoded in Base64.
# To encode your token, run: echo -n 'your_token_from_login' | base64
# apiVersion: v1
# kind: Secret
# metadata:
# name: garth-mcp-secret
# namespace: default
# type: Opaque
# data:
# # This key MUST be GARTH_TOKEN to match the application's environment variable
# GARTH_TOKEN: your_base64_encoded_token_here
---
# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: garth-mcp-server
namespace: n8n
labels:
app: garth-mcp-server
spec:
replicas: 1
selector:
matchLabels:
app: garth-mcp-server
template:
metadata:
labels:
app: garth-mcp-server
spec:
containers:
- name: garth-mcp-server
# Use a Python image version >= 3.13 as requested.
image: python:3.13-slim
resources:
requests:
memory: "64Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "500m"
# This command now installs dependencies and directly executes the mounted script.
command: ["/bin/sh", "-c"]
args: [
"pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir uv mcp-proxy && \
echo '--- Setup complete, starting server ---' && \
mcp-proxy --host=0.0.0.0 --port=8080 --pass-environment uvx garth-mcp-server"
]
ports:
- containerPort: 8080
name: http
# Inject the Garmin token securely from the Kubernetes Secret.
envFrom:
- secretRef:
name: garth-token-secret
# # Health probes for Kubernetes to manage the pod's lifecycle.
# livenessProbe:
# tcpSocket:
# port: 8080
# initialDelaySeconds: 15
# periodSeconds: 20
# readinessProbe:
# tcpSocket:
# port: 8080
# initialDelaySeconds: 60
# periodSeconds: 10
---
# --- 3. Service to expose the Deployment ---
# This creates a stable internal endpoint for the server.
apiVersion: v1
kind: Service
metadata:
name: garth-mcp-service
namespace: n8n
spec:
selector:
app: garth-mcp-server
ports:
- name: http
protocol: TCP
# The port the service will be available on within the cluster
port: 80
# The port on the container that the service will forward traffic to
targetPort: 8080
# ClusterIP is the default, but we're explicit here.
# This service is only reachable from within the Kubernetes cluster.
type: ClusterIP