Mercurial > code > home > repos > victoriametrics
changeset 0:7fe15c93585a
start
author | drewp@bigasterisk.com |
---|---|
date | Wed, 09 Feb 2022 00:20:56 -0800 |
parents | |
children | cd83f8fecc66 |
files | deploy.yaml roles.yaml skaffold.yaml vmalert.yaml volumes.yaml |
diffstat | 5 files changed, 202 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deploy.yaml Wed Feb 09 00:20:56 2022 -0800 @@ -0,0 +1,58 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: victoriametrics +spec: + replicas: 1 + strategy: { type: Recreate } + selector: + matchLabels: + app: victoriametrics + template: + metadata: + labels: + app: victoriametrics + annotations: { "prometheus.io/scrape": "false" } + spec: + volumes: + - name: data + persistentVolumeClaim: + claimName: opt-victoriametrics + serviceAccountName: victoriametrics + containers: + - name: victoriametrics + image: victoriametrics/victoria-metrics:heads-public-single-node-0-gd0f785def + args: + - -storageDataPath=/data + - -memory.allowedBytes=512MB + - -http.pathPrefix=/m/ + - -promscrape.config=/data/scrape_config.yaml + - -loggerTimezone=America/Los_Angeles + - -retentionPeriod=10y + - -sortLabels + ports: + - containerPort: 8428 + volumeMounts: + - { name: data, mountPath: /data } + resources: + limits: + memory: 0.5Gi + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: "kubernetes.io/hostname" + operator: In + values: ["bang"] +--- +apiVersion: v1 +kind: Service +metadata: + name: victoriametrics +spec: + ports: + - port: 80 + targetPort: 8428 + selector: + app: victoriametrics
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/roles.yaml Wed Feb 09 00:20:56 2022 -0800 @@ -0,0 +1,43 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: victoriametrics +rules: +- apiGroups: [""] + resources: + - nodes + - nodes/metrics + - nodes/proxy + - services + - endpoints + - pods + verbs: ["get", "list", "watch"] +- apiGroups: + - extensions + resources: + - ingresses + verbs: ["get", "list", "watch"] +- nonResourceURLs: ["/metrics"] + verbs: ["get"] +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: victoriametrics +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: victoriametrics +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: victoriametrics +subjects: +- kind: ServiceAccount + name: victoriametrics + namespace: default +# # couldn't get prometheus to read the per-node telegraf metrics as 'prometheus' account +# - kind: ServiceAccount +# name: default +# namespace: default \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/skaffold.yaml Wed Feb 09 00:20:56 2022 -0800 @@ -0,0 +1,10 @@ +apiVersion: skaffold/v2beta26 +kind: Config +metadata: { name: victoriametrics } +deploy: + kubectl: + manifests: + - "roles.yaml" + - "volumes.yaml" + - "deploy.yaml" + - "vmalert.yaml" \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vmalert.yaml Wed Feb 09 00:20:56 2022 -0800 @@ -0,0 +1,60 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: vmalert +spec: + replicas: 1 + strategy: { type: Recreate } + selector: + matchLabels: + app: vmalert + template: + metadata: + labels: + app: vmalert + annotations: { "prometheus.io/scrape": "false" } + spec: + volumes: + - name: data + persistentVolumeClaim: + claimName: opt-victoriametrics + serviceAccountName: victoriametrics + containers: + - name: vmalert + image: victoriametrics/vmalert:v1.72.0 + args: + - -rule=/data/rules/*.yaml + - -datasource.url=http://victoriametrics.default.svc.cluster.local/m/ + - -notifier.url=http://alertmanager.default.svc.cluster.local + - -remoteWrite.url=http://victoriametrics.default.svc.cluster.local/m/ + - -remoteRead.url=http://victoriametrics.default.svc.cluster.local/m/ + - -http.pathPrefix=/vmalert/ + - -loggerTimezone=America/Los_Angeles + - -external.url=https://bigasterisk.com/vmalert + - -memory.allowedBytes=512MB + ports: + - containerPort: 8880 + volumeMounts: + - { name: data, mountPath: /data } + resources: + limits: + memory: 0.5Gi + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: "kubernetes.io/hostname" + operator: In + values: ["bang"] +--- +apiVersion: v1 +kind: Service +metadata: + name: vmalert +spec: + ports: + - port: 80 + targetPort: 8880 + selector: + app: vmalert
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/volumes.yaml Wed Feb 09 00:20:56 2022 -0800 @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: opt-victoriametrics + labels: + type: local +spec: + storageClassName: manual + hostPath: + path: "/opt/victoriametrics" + capacity: + storage: 50Gi + accessModes: + - ReadWriteMany + persistentVolumeReclaimPolicy: Retain + claimRef: + namespace: default + name: opt-victoriametrics +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: opt-victoriametrics +spec: + storageClassName: "" + volumeName: "opt-victoriametrics" + accessModes: + - ReadWriteMany + resources: + requests: + storage: 50Gi \ No newline at end of file