Files
kubernetes/victoria-metrics/vmselect.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: vmselect
labels:
app.kubernetes.io/name: vmselect
app.kubernetes.io/component: vmselect
spec:
ports:
- port: 8481
name: vmselect
selector:
app.kubernetes.io/name: vmselect
app.kubernetes.io/component: vmselect
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: vmselect
labels:
app.kubernetes.io/name: vmselect
app.kubernetes.io/component: vmselect
spec:
selector:
matchLabels:
app.kubernetes.io/name: vmselect
app.kubernetes.io/component: vmselect
template:
metadata:
labels:
app.kubernetes.io/name: vmselect
app.kubernetes.io/component: vmselect
spec:
containers:
- name: vmselect
image: docker.io/victoriametrics/vmselect:v1.96.0-cluster
args:
- -envflag.enable=true
- -envflag.prefix=vmselect_
- -httpListenAddr=0.0.0.0:8481
ports:
- containerPort: 8481
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: {}