Files
mg4/k8s/influxdb.yaml
T
nilsandClaude Opus 5.5 c253876ed2 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>
2026-10-17 14:11:58 +02:00

131 lines
3.4 KiB
YAML

# InfluxDB 2, cluster-internal only. On first start (empty volume) the image's setup mode
# creates the org, the bucket and the admin token from the influxdb-auth Secret; on later
# starts those variables are ignored and the data on the volume wins.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: influxdb
namespace: mg4
labels:
app.kubernetes.io/name: influxdb
app.kubernetes.io/part-of: mg4
spec:
serviceName: influxdb
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: influxdb
template:
metadata:
labels:
app.kubernetes.io/name: influxdb
app.kubernetes.io/part-of: mg4
spec:
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
seccompProfile:
type: RuntimeDefault
containers:
- name: influxdb
image: docker.io/library/influxdb:2.7.12-alpine
ports:
- name: http
containerPort: 8086
env:
- name: INFLUXD_REPORTING_DISABLED
value: "true"
- name: DOCKER_INFLUXDB_INIT_MODE
value: setup
- name: DOCKER_INFLUXDB_INIT_ORG
value: mg4
- name: DOCKER_INFLUXDB_INIT_BUCKET
value: mg4
- name: DOCKER_INFLUXDB_INIT_USERNAME
value: admin
- name: DOCKER_INFLUXDB_INIT_PASSWORD
valueFrom:
secretKeyRef:
name: influxdb-auth
key: admin-password
- name: DOCKER_INFLUXDB_INIT_ADMIN_TOKEN
valueFrom:
secretKeyRef:
name: influxdb-auth
key: admin-token
volumeMounts:
- name: data
mountPath: /var/lib/influxdb2
- name: config
mountPath: /etc/influxdb2
readinessProbe:
httpGet:
path: /health
port: http
periodSeconds: 10
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 30
periodSeconds: 30
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
memory: 1Gi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
volumes:
- name: config
emptyDir: {}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
# No storageClassName: the cluster's default class is used.
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
name: influxdb
namespace: mg4
labels:
app.kubernetes.io/name: influxdb
app.kubernetes.io/part-of: mg4
spec:
selector:
app.kubernetes.io/name: influxdb
ports:
- name: http
port: 8086
targetPort: http
---
# Only the server may reach InfluxDB. Has no effect on a CNI without NetworkPolicy support.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: influxdb-from-server-only
namespace: mg4
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: influxdb
policyTypes: ["Ingress"]
ingress:
- from:
- podSelector:
matchLabels:
app.kubernetes.io/name: mg4-server
ports:
- port: 8086