User-defined Playground

VictoriaMetrics on Kubernetes Playground

VictoriaMetrics Operator on a multi-node Kubernetes cluster.

Startup configuration
dev-machine
cplane-01
node-01
node-02
VictoriaMetrics on Kubernetes playground: VictoriaMetrics Operator on a multi-node Kubernetes cluster.

What's included

A multi-node Kubernetes cluster with the VictoriaMetrics Operator pre-installed.

MachineRole
dev-machineYour workstation
cplane-01Control plane node
node-01, node-02Worker nodes

The VictoriaMetrics Operator is installed in the vm namespace using the upstream release manifests. No VictoriaMetrics components are deployed: that's your job.

Operator version: v0.68.3

🎯 Getting Started

Check Operator

  1. Verify the cluster is ready:
kubectl get nodes
  1. Check that the VM Operator is running:
kubectl -n vm get pods
  1. Explore the available CRDs:
kubectl api-resources | grep victoriametrics

Deploy a Single-Node VictoriaMetrics Instance

kubectl apply -f - <<EOF
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMSingle
metadata:
  name: victoriametrics
spec:
  retentionPeriod: "7d"
  storage:
    accessModes:
      - ReadWriteOnce
    resources:
      requests:
        storage: 2Gi
EOF

Wait for it come up:

kubectl wait pods -l app.kubernetes.io/name=vmsingle --for=condition=Ready

Scrape kubelet Metrics from Every Node

kubectl apply -f - <<EOF
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAgent
metadata:
  name: vmagent
spec:
  selectAllByDefault: true
  replicaCount: 1
  remoteWrite:
    - url: "http://vmsingle-victoriametrics.default.svc:8428/api/v1/write"

---
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMNodeScrape
metadata:
  name: kubelet-metrics
spec:
  scheme: https
  tlsConfig:
    insecureSkipVerify: true
    caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
  bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
  interval: 15s
EOF

Query Metrics

Start a port forward to query VictoriaMetrics:

kubectl port-forward svc/vmsingle-victoriametrics 8428:8428 &
curl -s 'http://localhost:8428/api/v1/query?query=up' | jq

📚 Learn More

🧪 Playgrounds

Happy learning! 🚀

Start
Settings