99 lines
3.0 KiB
YAML
99 lines
3.0 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
|
|
workingDir: /app
|
|
# This command now installs dependencies and directly executes the mounted script.
|
|
command: ["/bin/sh", "-c"]
|
|
args:
|
|
- |
|
|
set -e
|
|
echo "----> Installing Python dependencies..."
|
|
pip install flask garth garth-mcp-server
|
|
echo "----> Dependencies installed."
|
|
echo "----> Starting Flask server from mounted script."
|
|
exec python /app/wrapper.py
|
|
ports:
|
|
- containerPort: 5000
|
|
name: http
|
|
# Mount the wrapper.py script from the ConfigMap into the container.
|
|
volumeMounts:
|
|
- name: wrapper-script-volume
|
|
mountPath: /app/wrapper.py
|
|
subPath: wrapper.py
|
|
# 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:
|
|
httpGet:
|
|
path: /healthz
|
|
port: 5000
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 20
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: 5000
|
|
# Increased delay to allow for dependency installation.
|
|
initialDelaySeconds: 60
|
|
periodSeconds: 10
|
|
# Define the volume that will be populated by the ConfigMap.
|
|
volumes:
|
|
- name: wrapper-script-volume
|
|
configMap:
|
|
name: garth-wrapper-script
|
|
---
|
|
# --- 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 |