Add Kubernetes manifests for car.stinnesbeck.com
Namespace, InfluxDB 2.7.12 StatefulSet with PVC and a NetworkPolicy that admits only the server, the server Deployment (non-root, read-only root filesystem), a cert-manager Certificate from letsencrypt-prod and a Traefik IngressRoute. Secrets are a template only. Nothing is applied; k8s/README.md has the steps. Server version bumped to 1.1.0. Validated offline with kustomize and kubeconform (including the cert-manager and Traefik CRD schemas). The InfluxDB container was tested locally as UID 1000 with no capabilities. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+103
@@ -0,0 +1,103 @@
|
||||
# The car server. One replica on purpose: the ABRP rate limit is kept in memory, and two
|
||||
# replicas would each forward to ABRP at the full rate.
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mg4-server
|
||||
namespace: mg4
|
||||
labels:
|
||||
app.kubernetes.io/name: mg4-server
|
||||
app.kubernetes.io/part-of: mg4
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: mg4-server
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: mg4-server
|
||||
app.kubernetes.io/part-of: mg4
|
||||
spec:
|
||||
# Needed only if the image is private on git.stinnesbeck.com; see secrets.example.yaml.
|
||||
imagePullSecrets:
|
||||
- name: git-stinnesbeck-registry
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 10001
|
||||
runAsGroup: 10001
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
containers:
|
||||
- name: server
|
||||
image: git.stinnesbeck.com/nils/mg4-server:latest # pinned by kustomization.yaml
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 3000
|
||||
env:
|
||||
- name: INFLUX_URL
|
||||
value: http://influxdb.mg4.svc:8086
|
||||
- name: INFLUX_ORG
|
||||
value: mg4
|
||||
- name: INFLUX_BUCKET
|
||||
value: mg4
|
||||
- name: INFLUX_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: influxdb-auth
|
||||
key: admin-token
|
||||
# INGEST_TOKEN, SESSION_SECRET, DASHBOARD_PASSWORD, ABRP_API_KEY, ABRP_USER_TOKEN.
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: mg4-server
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /v1/health
|
||||
port: http
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /v1/health
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 30
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
memory: 512Mi
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop: ["ALL"]
|
||||
volumeMounts:
|
||||
# Next.js writes its fetch/image cache here; the rest of the filesystem is read-only.
|
||||
- name: next-cache
|
||||
mountPath: /app/.next/cache
|
||||
- name: tmp
|
||||
mountPath: /tmp
|
||||
volumes:
|
||||
- name: next-cache
|
||||
emptyDir: {}
|
||||
- name: tmp
|
||||
emptyDir: {}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mg4-server
|
||||
namespace: mg4
|
||||
labels:
|
||||
app.kubernetes.io/name: mg4-server
|
||||
app.kubernetes.io/part-of: mg4
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/name: mg4-server
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: http
|
||||
Reference in New Issue
Block a user