Files
kubernetes/victoria-metrics/vminsert.yaml
Dustin C. Hatch 8f088fb6ae v-m: Deploy (clustered) Victoria Metrics
Since *mtrcs0.pyrocufflink.blue* (the Metrics Pi) seems to be dying,
I decided to move monitoring and alerting into Kubernetes.

I was originally planning to have a single, dedicated virtual machine
for Victoria Metrics and Grafana, similar to how the Metrics Pi was set
up, but running Fedora CoreOS instead of a custom Buildroot-based OS.
While I was working on the Ignition configuration for the VM, it
occurred to me that monitoring would be interrupted frequently, since
FCOS updates weekly and all updates require a reboot.  I would rather
not have that many gaps in the data.  Ultimately I decided that
deploying a cluster with Kubernetes would probably be more robust and
reliable, as updates can be performed without any downtime at all.

I chose not to use the Victoria Metrics Operator, but rather handle
the resource definitions myself.  Victoria Metrics components are not
particularly difficult to deploy, so the overhead of running the
operator and using its custom resources would not be worth the minor
convenience it provides.
2024-01-01 17:48:10 -06:00

70 lines
1.6 KiB
YAML

apiVersion: v1
kind: Service
metadata:
name: vminsert
labels:
app.kubernetes.io/name: vminsert
app.kubernetes.io/component: vminsert
spec:
ports:
- port: 8480
name: vminsert
selector:
app.kubernetes.io/name: vminsert
app.kubernetes.io/component: vminsert
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: vminsert
labels:
app.kubernetes.io/name: vminsert
app.kubernetes.io/component: vminsert
spec:
selector:
matchLabels:
app.kubernetes.io/name: vminsert
app.kubernetes.io/component: vminsert
template:
metadata:
labels:
app.kubernetes.io/name: vminsert
app.kubernetes.io/component: vminsert
spec:
containers:
- name: vminsert
image: docker.io/victoriametrics/vminsert:v1.96.0-cluster
args:
- -envflag.enable=true
- -envflag.prefix=vminsert_
- -httpListenAddr=0.0.0.0:8480
ports:
- containerPort: 8480
name: http
readinessProbe: &probe
httpGet:
port: http
path: /health
periodSeconds: 60
startupProbe:
<<: *probe
periodSeconds: 1
successThreshold: 1
failureThreshold: 30
timeoutSeconds: 1
securityContext:
runAsNonRoot: true
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp
subPath: tmp
securityContext:
runAsGroup: 2093
runAsNonRoot: true
runAsUser: 2093
volumes:
- name: tmp
emptyDir: {}