apiVersion: apps/v1
kind: Deployment
metadata:
  name: next-victoriametrics-vmstorage
spec:
  replicas: 1
  strategy: { type: Recreate }
  selector:  { matchLabels: { app: next-victoriametrics-vmstorage } }
  template:
    metadata:
      labels:
        app: next-victoriametrics-vmstorage
      annotations: 
        prometheus.io/scrape: "true"
        prometheus.io/path: "/m/vmstorage/metrics"
        prometheus.io/port: "80"
    spec:
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: next-victoriametrics
      serviceAccountName: victoriametrics
      containers:
        - name: vmstorage
          # https://hub.docker.com/r/victoriametrics/victoria-metrics/tags also check vmalert.yaml
          image: docker.io/victoriametrics/vmstorage:v1.100.1-cluster
          args:
            - -http.pathPrefix=/m/next/vmstorage/
            - -loggerTimezone=America/Los_Angeles
            - -retentionPeriod=10y
            - -storageDataPath=/data
          ports:
            - containerPort: 8482 # http?
            - containerPort: 8400 # vminsert server
            - containerPort: 8401 # vmselect server
          volumeMounts:
            - { name: data, mountPath: /data }
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: "kubernetes.io/hostname"
                    operator: In
                    values: ["ditto"]
---
apiVersion: v1
kind: Service
metadata:
  name: next-victoriametrics-vmstorage
spec:
  ports:
    - {port: 80, targetPort: 8482 }
    - {port: 8401, targetPort: 8401 }
  selector:
    app: next-victoriametrics-vmstorage
---
apiVersion: v1
kind: Service
metadata:
  name: next-victoriametrics-vmstorage-write
spec:
  ports:
    - {port: 8400, targetPort: 8400 }
  selector:
    app: next-victoriametrics-vmstorage
