Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Amper committed Aug 30, 2023
1 parent 725c7bb commit 3c2c6f1
Show file tree
Hide file tree
Showing 25 changed files with 96 additions and 116 deletions.
14 changes: 7 additions & 7 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ in a declarative style according to [GitOps](https://www.redhat.com/en/topics/de
and [IaC](https://en.wikipedia.org/wiki/Infrastructure_as_code) concepts.

VictoriaMetrics also provides [helm charts](https://github.com/VictoriaMetrics/helm-charts) without operator.
Operator makes the same, simplifies it and provides [advanced features](https://docs.victorimetrics.com/vmoperator/#features).
Operator makes the same, simplifies it and provides [advanced features](https://docs.victorimetrics.com/operator/#features).

Learn more about [key concepts](#key-concepts) of `vmoperator` and follow the **[quick start guide](https://docs.victoriametrics.com/vmoperator/quickstart.html)** for a better experience.
Learn more about [key concepts](#key-concepts) of `vmoperator` and follow the **[quick start guide](https://docs.victoriametrics.com/operator/quickstart.html)** for a better experience.

## Features of vmoperator

- Deployment and management in a kubernetes clusters of any number of VictoriaMetrics applications (like vmsingle/vmcluster instances and another components like vmauth, vmagent, vmalert, etc...)
- Seamless [migration from prometheus-operator](https://docs.victoriametrics.com/vmoperator/migration.html) with auto-conversion of prometheus [custom resources](#custom-resources)
- Simple VictoriaMetrics cluster installation, configuring, upgrading and managing with [crd-objects](https://docs.victoriametrics.com/vmoperator/resources/).
- Seamless [migration from prometheus-operator](https://docs.victoriametrics.com/operator/migration.html) with auto-conversion of prometheus [custom resources](#custom-resources)
- Simple VictoriaMetrics cluster installation, configuring, upgrading and managing with [crd-objects](https://docs.victoriametrics.com/operator/resources/).
- Ability to delegate the configuration (parts of configuration) of applications monitoring to the end-users and managing access to different configurations or configuration sections.
- Integration with VictoriaMetrics [vmbackupmanager](https://docs.victoriametrics.com/vmbackupmanager.html) - advanced tools for making backups. Check [backup docs](https://docs.victoriametrics.com/vmoperator/backups.html)
- Everything you need for monitoring out of the box in [k8s-stack helm chart](http://docs.victoriametrics.com/vmoperator/deploy.html) with ready-made usecases and solutions.
- Integration with VictoriaMetrics [vmbackupmanager](https://docs.victoriametrics.com/vmbackupmanager.html) - advanced tools for making backups. Check [backup docs](https://docs.victoriametrics.com/operator/backups.html)
- Everything you need for monitoring out of the box in [k8s-stack helm chart](http://docs.victoriametrics.com/operator/deploy.html) with ready-made usecases and solutions.
- Ability to template your own deployment scenarios.

## Key Concepts
Expand Down Expand Up @@ -63,7 +63,7 @@ The basic workflow of working with the operator can be simplified as the followi

<img src="README_operator-workflow.png" width="1200">

- Operator declares and owns [resources of Victoria Metrics](http://docs.victoriametrics.com/vmoperator/resources/).
- Operator declares and owns [resources of Victoria Metrics](http://docs.victoriametrics.com/operator/resources/).
- Kubernetes validates of the resource according to the specification from CRD (see more in [custom resources](#custom-resources)).
- Operator subscribed to change events (`create`, `update`, `delete`) for related resources.
- When an event occurs, the operator reacts and updates the state of the objects in the cluster.
Expand Down
36 changes: 10 additions & 26 deletions docs/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ It adds missing authorization and access control features and enforces it.

Access can be given with `VMUser` definition. It supports basic auth and bearer token authentication:

```console
cat << EOF | kubectl apply -f -
```yaml
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAuth
metadata:
Expand All @@ -24,13 +23,11 @@ spec:
userNamespaceSelector: {}
userSelector: {}
ingress: {}
EOF
```
Advanced configuration with cert-manager annotations:
```console
cat << EOF | kubectl apply -f -
```yaml
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAuth
metadata:
Expand All @@ -56,14 +53,12 @@ spec:
class_name: nginx
tlsHosts:
- vm-access.example.com
EOF
```
Simple static routing with read-only access to vmagent for username - `user-1` with password `Asafs124142`:

```console
```yaml
# curl vmauth:8427/metrics -u 'user-1:Asafs124142'
cat << EOF | kubectl apply -f
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMUser
metadata:
Expand All @@ -74,14 +69,12 @@ spec:
- static:
url: http://vmagent-base.default.svc:8429
paths: ["/targets/api/v1","/targets","/metrics"]
EOF
```

With bearer token access:

```console
```yaml
# curl vmauth:8427/metrics -H 'Authorization: Bearer Asafs124142'
cat << EOF | kubectl apply -f
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMUser
metadata:
Expand All @@ -92,14 +85,12 @@ spec:
- static:
url: http://vmagent-base.default.svc:8429
paths: ["/targets/api/v1","/targets","/metrics"]
EOF
```

It's also possible to use service discovery for objects:

```console
```yaml
# curl vmauth:8427/metrics -H 'Authorization: Bearer Asafs124142'
cat << EOF | kubectl apply -f
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMUser
metadata:
Expand All @@ -112,13 +103,11 @@ spec:
name: base
namespace: default
paths: ["/targets/api/v1","/targets","/metrics"]
EOF
```

Cluster components supports auto path generation for single tenant view:

```console
cat << EOF | kubectl apply -f -
```yaml
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMUser
metadata:
Expand All @@ -140,17 +129,15 @@ spec:
url: http://vmselect-test-persistent.default.svc:8481/
paths:
- /internal/resetRollupResultCache
EOF
```

For each `VMUser` operator generates corresponding secret with username/password or bearer token at the same namespace as `VMUser`.

## Basic auth for targets

To authenticate a `VMServiceScrape`s over a metrics endpoint use [`basicAuth`](https://docs.victoriametrics.com/vmoperator/api.html#basicauth):
To authenticate a `VMServiceScrape`s over a metrics endpoint use [`basicAuth`](https://docs.victoriametrics.com/operator/api.html#basicauth):

```console
cat << EOF | kubectl apply -f -
```yaml
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMServiceScrape
metadata:
Expand All @@ -170,11 +157,9 @@ spec:
selector:
matchLabels:
app: myapp
EOF
```
```console
cat << EOF | kubectl apply -f -
---
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -183,5 +168,4 @@ data:
password: dG9vcg== # toor
user: YWRtaW4= # admin
type: Opaque
EOF
```
4 changes: 2 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ title: Configuration

# Configuration

Operator configured by env variables, list of it can be found at [link](https://docs.victoriametrics.com/vmoperator/vars.html).
Operator configured by env variables, list of it can be found at [link](https://docs.victoriametrics.com/operator/vars.html).

It defines default configuration options, like images for components, timeouts, features.

## Conversion of prometheus-operator objects

You can read detailed instructions about configuring prometheus-objects conversion in [this document](http://docs.victoriametrics.com/vmoperator/migration.html).
You can read detailed instructions about configuring prometheus-objects conversion in [this document](http://docs.victoriametrics.com/operator/migration.html).

## Helm-charts

Expand Down
24 changes: 10 additions & 14 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ title: FAQ

## How do you monitor the operator itself?

You can read about vmoperator monitoring in [this document](https://docs.victoriametrics.com/vmoperator/monitoring.html).
You can read about vmoperator monitoring in [this document](https://docs.victoriametrics.com/operator/monitoring.html).

## How to change VMStorage PVC storage class

Expand All @@ -31,36 +31,36 @@ With Operator deployment:

You can use `VM_CONTAINERREGISTRY` parameter for operator:

- See details about tuning [operator settings here](https://docs.victoriametrics.com/vmoperator/setup.html#settings).
- See [available operator settings](https://docs.victoriametrics.com/vmoperator/vars.html) here.
- See details about tuning [operator settings here](https://docs.victoriametrics.com/operator/setup.html#settings).
- See [available operator settings](https://docs.victoriametrics.com/operator/vars.html) here.

## How to override image

TODO

## How to set up automatic backups?

You can read about backups setup in [this guide](https://docs.victoriametrics.com/vmoperator/guides/backups.html).
You can read about backups setup in [this guide](https://docs.victoriametrics.com/operator/guides/backups.html).

## How to migrate from Prometheus-operator to VictoriaMetrics operator?

You can read about migration from prometheus operator on [this page](https://docs.victoriametrics.com/vmoperator/migration.html).
You can read about migration from prometheus operator on [this page](https://docs.victoriametrics.com/operator/migration.html).

## How to turn off conversion for prometheus resources

You can read about it on [this page](https://docs.victoriametrics.com/vmoperator/migration.html#objects-convesion).
You can read about it on [this page](https://docs.victoriametrics.com/operator/migration.html#objects-convesion).

## My VM objects are not deleted/changed when I delete/change Prometheus objects

You can read about it in following sections of "Migration from prometheus-operator" docs:

- [Deletion synchronization](https://docs.victoriametrics.com/vmoperator/migration.html#deletion-synchronization)
- [Update synchronization](https://docs.victoriametrics.com/vmoperator/migration.html#update-synchronization)
- [Labels synchronization](https://docs.victoriametrics.com/vmoperator/migration.html#labels-synchronization)
- [Deletion synchronization](https://docs.victoriametrics.com/operator/migration.html#deletion-synchronization)
- [Update synchronization](https://docs.victoriametrics.com/operator/migration.html#update-synchronization)
- [Labels synchronization](https://docs.victoriametrics.com/operator/migration.html#labels-synchronization)

## What permissions does an operator need to run in a cluster?

You can read about needed permissions for operator in [this document](https://docs.victoriametrics.com/vmoperator/security.html#roles).
You can read about needed permissions for operator in [this document](https://docs.victoriametrics.com/operator/security.html#roles).

## How to run VictoriaMetrics operator with permissions for one namespace only?

Expand All @@ -83,10 +83,6 @@ and disable CRD controller with flag: `--controller.disableCRDOwnership=true`

**TODO**

## **TODO** ArgoCD

**TODO**

## TODO: How to scale/replicate vmoperator?

**TODO**
4 changes: 2 additions & 2 deletions docs/guides/backups.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ It contains a description of the service and its features. This documentation co

## Usage examples

[`VMSingle`](https://docs.victoriametrics.com/vmoperator/resources/vmsingle.html) and [`VMCluster`](https://docs.victoriametrics.com/vmoperator/resources/vmcluster.html)
[`VMSingle`](https://docs.victoriametrics.com/operator/resources/vmsingle.html) and [`VMCluster`](https://docs.victoriametrics.com/operator/resources/vmcluster.html)
has built-in backup configuration, it uses `vmbackupmanager` - proprietary tool for backups.
It supports incremental backups (hourly, daily, weekly, monthly) with popular object storages (aws s3, google cloud storage).

Expand Down Expand Up @@ -76,7 +76,7 @@ It's needed to make consistent backups for each storage node.
You can read more about backup configuration options and mechanics [here](https://docs.victoriametrics.com/vmbackup.html)
Possible configuration options for backup crd can be found at [link](https://docs.victoriametrics.com/vmoperator/api.html#vmbackup)
Possible configuration options for backup crd can be found at [link](https://docs.victoriametrics.com/operator/api.html#vmbackup)
## Restoring backups
Expand Down
48 changes: 24 additions & 24 deletions docs/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ So you can use familiar CRD objects: `ServiceMonitor`, `PodMonitor`, `Prometheus

Or you can use VictoriaMetrics CRDs:

- `VMServiceScrape` (instead of `ServiceMonitor`) - defines scraping metrics configuration from pods backed by services. [See details](https://docs.victoriametrics.com/vmoperator/resources/vmservicescrape.html).
- `VMPodScrape` (instead of `PodMonitor`) - defines scraping metrics configuration from pods. [See details](https://docs.victoriametrics.com/vmoperator/resources/vmpodscrape.html).
- `VMRule` (instead of `PrometheusRule`) - defines alerting or recording rules. [See details](https://docs.victoriametrics.com/vmoperator/resources/vmrule.html).
- `VMProbe` (instead of `Probe`) - defines a probing configuration for targets with blackbox exporter. [See details](https://docs.victoriametrics.com/vmoperator/resources/vmprobe.html).
- `VMAlertmanagerConfig` (instead of `AlertmanagerConfig`) - defines a configuration for AlertManager. [See details](https://docs.victoriametrics.com/vmoperator/resources/vmalertmanagerconfig.html).
- `VMServiceScrape` (instead of `ServiceMonitor`) - defines scraping metrics configuration from pods backed by services. [See details](https://docs.victoriametrics.com/operator/resources/vmservicescrape.html).
- `VMPodScrape` (instead of `PodMonitor`) - defines scraping metrics configuration from pods. [See details](https://docs.victoriametrics.com/operator/resources/vmpodscrape.html).
- `VMRule` (instead of `PrometheusRule`) - defines alerting or recording rules. [See details](https://docs.victoriametrics.com/operator/resources/vmrule.html).
- `VMProbe` (instead of `Probe`) - defines a probing configuration for targets with blackbox exporter. [See details](https://docs.victoriametrics.com/operator/resources/vmprobe.html).
- `VMAlertmanagerConfig` (instead of `AlertmanagerConfig`) - defines a configuration for AlertManager. [See details](https://docs.victoriametrics.com/operator/resources/vmalertmanagerconfig.html).

Note that Prometheus CRDs are not supplied with the VictoriaMetrics operator,
so you need to [install them separately](https://github.com/prometheus-operator/prometheus-operator/releases).
Expand Down Expand Up @@ -64,12 +64,12 @@ Otherwise, VictoriaMetrics Operator would try to discover prometheus-operator AP

<img src="migration_prometheus-conversion.png" width="1200">

For more information about the operator's workflow, see [this doc](https://docs.victoriametrics.com/vmoperator/#workflow).
For more information about the operator's workflow, see [this doc](https://docs.victoriametrics.com/operator/#workflow).

## Deletion synchronization

By default, the operator doesn't make converted objects disappear after original ones are deleted. To change this behaviour
configure adding `OwnerReferences` to converted objects with following [operator parameter](https://docs.victoriametrics.com/vmoperator/setup.html#settings):
configure adding `OwnerReferences` to converted objects with following [operator parameter](https://docs.victoriametrics.com/operator/setup.html#settings):

```console
VM_ENABLEDPROMETHEUSCONVERTEROWNERREFERENCES=true
Expand Down Expand Up @@ -116,14 +116,14 @@ spec:
Annotation `operator.victoriametrics.com/ignore-prometheus-updates` can be set on one of the resources:

- [VMServiceScrape](https://docs.victoriametrics.com/vmoperator/resources/vmservicescrape.html)
- [VMPodScrape](https://docs.victoriametrics.com/vmoperator/resources/vmpodscrape.html)
- [VMRule](https://docs.victoriametrics.com/vmoperator/resources/vmrule.html)
- [VMProbe](https://docs.victoriametrics.com/vmoperator/resources/vmprobe.html)
- [VMAlertmanagerConfig](https://docs.victoriametrics.com/vmoperator/resources/vmalertmanagerconfig.html)
- [VMServiceScrape](https://docs.victoriametrics.com/operator/resources/vmservicescrape.html)
- [VMPodScrape](https://docs.victoriametrics.com/operator/resources/vmpodscrape.html)
- [VMRule](https://docs.victoriametrics.com/operator/resources/vmrule.html)
- [VMProbe](https://docs.victoriametrics.com/operator/resources/vmprobe.html)
- [VMAlertmanagerConfig](https://docs.victoriametrics.com/operator/resources/vmalertmanagerconfig.html)

And annotation doesn't make sense for [VMStaticScrape](https://docs.victoriametrics.com/vmoperator/resources/vmstaticscrape.html)
and [VMNodeScrape](https://docs.victoriametrics.com/vmoperator/resources/vmnodescrape.html) because these objects are not created as a result of conversion.
And annotation doesn't make sense for [VMStaticScrape](https://docs.victoriametrics.com/operator/resources/vmstaticscrape.html)
and [VMNodeScrape](https://docs.victoriametrics.com/operator/resources/vmnodescrape.html) because these objects are not created as a result of conversion.

## Labels and annotations synchronization

Expand Down Expand Up @@ -156,25 +156,25 @@ spec:

Annotation `operator.victoriametrics.com/merge-meta-strategy` can be set on one of the resources:

- [VMServiceScrape](https://docs.victoriametrics.com/vmoperator/resources/vmservicescrape.html)
- [VMPodScrape](https://docs.victoriametrics.com/vmoperator/resources/vmpodscrape.html)
- [VMRule](https://docs.victoriametrics.com/vmoperator/resources/vmrule.html)
- [VMProbe](https://docs.victoriametrics.com/vmoperator/resources/vmprobe.html)
- [VMAlertmanagerConfig](https://docs.victoriametrics.com/vmoperator/resources/vmalertmanagerconfig.html)
- [VMServiceScrape](https://docs.victoriametrics.com/operator/resources/vmservicescrape.html)
- [VMPodScrape](https://docs.victoriametrics.com/operator/resources/vmpodscrape.html)
- [VMRule](https://docs.victoriametrics.com/operator/resources/vmrule.html)
- [VMProbe](https://docs.victoriametrics.com/operator/resources/vmprobe.html)
- [VMAlertmanagerConfig](https://docs.victoriametrics.com/operator/resources/vmalertmanagerconfig.html)

And annotation doesn't make sense for [VMStaticScrape](https://docs.victoriametrics.com/vmoperator/resources/vmstaticscrape.html)
and [VMNodeScrape](https://docs.victoriametrics.com/vmoperator/resources/vmnodescrape.html) because these objects are not created as a result of conversion.
And annotation doesn't make sense for [VMStaticScrape](https://docs.victoriametrics.com/operator/resources/vmstaticscrape.html)
and [VMNodeScrape](https://docs.victoriametrics.com/operator/resources/vmnodescrape.html) because these objects are not created as a result of conversion.

You can filter labels for syncing
with [operator parameter](https://docs.victoriametrics.com/vmoperator/setup.html#settings) `VM_FILTERPROMETHEUSCONVERTERLABELPREFIXES`:
with [operator parameter](https://docs.victoriametrics.com/operator/setup.html#settings) `VM_FILTERPROMETHEUSCONVERTERLABELPREFIXES`:

```console
# it excludes all labels that start with "helm.sh" or "argoproj.io" from synchronization
VM_FILTERPROMETHEUSCONVERTERLABELPREFIXES=helm.sh,argoproj.io
```

In the same way, annotations with specified prefixes can be excluded from synchronization
with [operator parameter](https://docs.victoriametrics.com/vmoperator/setup.html#settings) `VM_FILTERPROMETHEUSCONVERTERANNOTATIONPREFIXES`:
with [operator parameter](https://docs.victoriametrics.com/operator/setup.html#settings) `VM_FILTERPROMETHEUSCONVERTERANNOTATIONPREFIXES`:

```console
# it excludes all annotations that start with "helm.sh" or "argoproj.io" from synchronization
Expand All @@ -184,7 +184,7 @@ VM_FILTERPROMETHEUSCONVERTERANNOTATIONPREFIXES=helm.sh,argoproj.io
## Using converter with ArgoCD

If you use ArgoCD, you can allow ignoring objects at ArgoCD converted from Prometheus CRD
with [operator parameter](https://docs.victoriametrics.com/vmoperator/setup.html#settings) `VM_PROMETHEUSCONVERTERADDARGOCDIGNOREANNOTATIONS`.
with [operator parameter](https://docs.victoriametrics.com/operator/setup.html#settings) `VM_PROMETHEUSCONVERTERADDARGOCDIGNOREANNOTATIONS`.

It helps to properly use converter with ArgoCD and should help prevent out-of-sync issues with argo-cd based deployments:

Expand Down
Loading

0 comments on commit 3c2c6f1

Please sign in to comment.