5cb0f221dc8ff0696b43ecc7d10413027b0c6929
[ric-plt/ric-dep.git] / helm / 3rdparty / influxdb / README.md
1 # InfluxDB Helm chart
2
3 [InfluxDB](https://github.com/influxdata/influxdb) is an open source time series database with no external dependencies. It's useful for recording metrics, events, and performing analytics.
4
5 The InfluxDB Helm chart uses the [Helm](https://helm.sh) package manager to bootstrap an InfluxDB StatefulSet and service on a [Kubernetes](http://kubernetes.io) cluster.
6
7 > **Note:** ### If you're using the InfluxDB Enterprise Helm chart, check out [InfluxDB Enterprise Helm chart](#influxdb-enterprise-helm-chart).
8
9 ## Prerequisites
10
11 - Helm v2 or later
12 - Kubernetes 1.4+
13 - (Optional) PersistentVolume (PV) provisioner support in the underlying infrastructure
14
15 ## Install the chart
16
17 1. Add the InfluxData Helm repository:
18
19    ```bash
20    helm repo add influxdata https://helm.influxdata.com/
21    ```
22
23 2. Run the following command, providing a name for your release:
24
25    ```bash
26    helm upgrade --install my-release influxdata/influxdb
27    ```
28
29    > **Tip**: `--install` can be shortened to `-i`.
30
31    This command deploys InfluxDB on the Kubernetes cluster using the default configuration. To find parameters you can configure during installation, see [Configure the chart](#configure-the-chart).
32
33    > **Tip**: To view all Helm chart releases, run `helm list`.
34
35 ## Uninstall the chart
36
37 To uninstall the `my-release` deployment, use the following command:
38
39 ```bash
40 helm uninstall my-release
41 ```
42
43 This command removes all the Kubernetes components associated with the chart and deletes the release.
44
45 ## Configure the chart
46
47 The following table lists configurable parameters, their descriptions, and their default values stored in `values.yaml`.
48
49 | Parameter | Description | Default |
50 |---|---|---|
51 | image.repository | Image repository url | influxdb |
52 | image.tag | Image tag | 1.8.0-alpine |
53 | image.pullPolicy | Image pull policy | IfNotPresent |
54 | image.pullSecrets | It will store the repository's credentials to pull image | nil |
55 | serviceAccount.create | It will create service account | true |
56 | serviceAccount.name | Service account name | "" |
57 | serviceAccount.annotations | Service account annotations | {} |
58 | livenessProbe | Health check for pod | {} |
59 | readinessProbe | Health check for pod | {} |
60 | startupProbe | Health check for pod | {} |
61 | service.type | Kubernetes service type | ClusterIP |
62 | service.loadBalancerIP | A user-specified IP address for service type LoadBalancer to use as External IP (if supported) | nil |
63 | service.externalIPs | A user-specified list of externalIPs to add to the service | nil |
64 | service.externalTrafficPolicy | A user specified external traffic policy | nil |
65 | persistence.enabled | Boolean to enable and disable persistance | true |
66 | persistence.existingClaim | An existing PersistentVolumeClaim, ignored if enterprise.enabled=true | nil |
67 | persistence.storageClass | If set to "-", storageClassName: "", which disables dynamic provisioning. If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner.  (gp2 on AWS, standard on GKE, AWS & OpenStack |  |
68 | persistence.annotations | Annotations for volumeClaimTemplates | nil |
69 | persistence.accessMode | Access mode for the volume | ReadWriteOnce |
70 | persistence.size | Storage size | 8Gi |
71 | podAnnotations | Annotations for pod | {} |
72 | podLabels | Labels for pod | {} |
73 | ingress.enabled | Boolean flag to enable or disable ingress | false |
74 | ingress.tls | Boolean to enable or disable tls for ingress. If enabled provide a secret in `ingress.secretName` containing TLS private key and certificate. | false |
75 | ingress.secretName | Kubernetes secret containing TLS private key and certificate. It is `only` required if `ingress.tls` is enabled. | nil |
76 | ingress.hostname | Hostname for the ingress | influxdb.foobar.com |
77 | ingress.annotations | ingress annotations | nil |
78 | schedulerName | Use an [alternate scheduler](https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/), e.g. "stork". | nil |
79 | nodeSelector | Node labels for pod assignment | {} |
80 | affinity | [Affinity](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity) for pod assignment |  {|
81 | tolerations | [Tolerations](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) for pod assignment | [] |
82 | securityContext | [securityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for pod | {} |
83 | env | environment variables for influxdb container | {} |
84 | volumes | `volumes` stanza(s) to be used in the main container | nil |
85 | mountPoints | `volumeMount` stanza(s) to be used in the main container | nil |
86 | extraContainers | Additional containers to be added to the pod | {} |
87 | config.reporting_disabled | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#reporting-disabled-false) | false |
88 | config.rpc | RPC address for backup and storage | {} |
89 | config.meta | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#meta) | {} |
90 | config.data | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#data) | {} |
91 | config.coordinator | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#coordinator) | {} |
92 | config.retention | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#retention) | {} |
93 | config.shard_precreation | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#shard-precreation) | {} |
94 | config.monitor | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#monitor) | {} |
95 | config.http | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#http) | {} |
96 | config.logging | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#logging) | {} |
97 | config.subscriber | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#subscriber) | {} |
98 | config.graphite | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#graphite) | {} |
99 | config.collectd | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#collectd) | {} |
100 | config.opentsdb | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#opentsdb) | {} |
101 | config.udp | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#udp) | {} |
102 | config.continous_queries | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#continuous-queries) | {} |
103 | config.tls | [Details](https://docs.influxdata.com/influxdb/v1.7/administration/config/#tls) | {} |
104 | initScripts.enabled | Boolean flag to enable and disable initscripts. If the container finds any files with the extensions .sh or .iql inside of the /docker-entrypoint-initdb.d folder, it will execute them. The order they are executed in is determined by the shell. This is usually alphabetical order. | false |
105 | initScripts.scripts | Init scripts | {} |
106 | backup.enabled | Enable backups, if `true` must configure one of the storage providers | `false` |
107 | backup.gcs | Google Cloud Storage config | `nil`
108 | backup.azure | Azure Blob Storage config | `nil`
109 | backup.s3 | Amazon S3 (or compatible) config | `nil`
110 | backup.schedule | Schedule to run jobs in cron format | `0 0 * * *` |
111 | backup.startingDeadlineSeconds | Deadline in seconds for starting the job if it misses its scheduled time for any reason | `nil` |
112 | backup.annotations | Annotations for backup cronjob | {} |
113 | backup.podAnnotations | Annotations for backup cronjob pods | {} |
114 | backup.persistence.enabled | Boolean to enable and disable persistance | false |
115 | backup.persistence.storageClass | If set to "-", storageClassName: "", which disables dynamic provisioning. If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner.  (gp2 on AWS, standard on GKE, AWS & OpenStack |  |
116 | backup.persistence.annotations | Annotations for volumeClaimTemplates | nil |
117 | backup.persistence.accessMode | Access mode for the volume | ReadWriteOnce |
118 | backup.persistence.size | Storage size | 8Gi |
119 | backup.resources | Resources requests and limits for `backup` pods | `ephemeral-storage: 8Gi` |
120
121 To configure the chart, do either of the following:
122
123 - Specify each parameter using the `--set key=value[,key=value]` argument to `helm upgrade --install`. For example:
124
125   ```bash
126   helm upgrade --install my-release \
127     --set persistence.enabled=true,persistence.size=200Gi \
128       influxdata/influxdb
129   ```
130
131   This command enables persistence and changes the size of the requested data volume to 200GB.
132
133 - Provide a YAML file that specifies the parameter values while installing the chart. For example, use the following command:
134
135   ```bash
136   helm upgrade --install my-release -f values.yaml influxdata/influxdb
137   ```
138
139   > **Tip**: Use the default [values.yaml](values.yaml).
140
141 For information about running InfluxDB in Docker, see the [full image documentation](https://hub.docker.com/_/influxdb/).
142
143 ### InfluxDB Enterprise Helm chart
144
145 [InfluxDB Enterprise](https://www.influxdata.com/products/influxdb-enterprise/) includes features designed for production workloads, including high availability and horizontal scaling. InfluxDB Enterprise requires an InfluxDB Enterprise license.
146
147 #### Configure the InfluxDB Enterprise chart
148
149 To enable InfluxDB Enterprise, set the following keys and values in a values file provided to Helm.
150
151 | Key | Description | Recommended value |
152 | --- | --- | --- |
153 | `livenessProbe.initalDelaySeconds` | Used to allow enough time to join meta nodes to a cluster | `3600` |
154 | `image.tag` | Set to a `data` image. See https://hub.docker.com/_/influxdb for details | `data` |
155 | `service.ClusterIP` | Use a headless service for StatefulSets | `"None"` |
156 | `env.name[_HOSTNAME]` | Used to provide a unique `name.service` for InfluxDB. See [values.yaml]() for an example | `valueFrom.fieldRef.fieldPath: metadata.name` |
157 | `enterprise.enabled` | Create StatefulSets for use with `influx-data` and `influx-meta` images | `true` |
158 | `enterprise.licensekey` | License for InfluxDB Enterprise |  |
159 | `enterprise.clusterSize` | Replicas for `influx` StatefulSet | Dependent on license |
160 | `enterprise.meta.image.tag` | Set to an `meta` image. See https://hub.docker.com/_/influxdb for details | `meta` |
161 | `enterprise.meta.clusterSize` | Replicas for `influxdb-meta` StatefulSet. | `3` |
162 | `enterprise.meta.resources` | Resources requests and limits for meta `influxdb-meta` pods | See `values.yaml` |
163
164 #### Join pods to InfluxDB Enterprise cluster
165
166 Meta and data pods must be joined using the command `influxd-ctl` found on meta pods.
167 We recommend running `influxd-ctl` on one and only one meta pod and joining meta pods together before data pods. For each meta pod, run `influxd-ctl`.
168
169 In the following examples, we use the pod names `influxdb-meta-0` and `influxdb-0` and the service name `influxdb`.
170
171 For example, using the default settings, your script should look something like this:
172
173 ```shell script
174 kubectl exec influxdb-meta-0 influxd-ctl add-meta influxdb-meta-0.influxdb-meta:8091
175 ```
176
177 From the same meta pod, for each data pod, run `influxd-ctl`. With default settings, your script should look something like this:
178
179 ```shell script
180 kubectl exec influxdb-meta-0 influxd-ctl add-data influxdb-0.influxdb:8088
181 ```
182
183 When using `influxd-ctl`, use the appropriate DNS name for your pods, following the naming scheme of `pod.service`.
184
185 ## Persistence
186
187 The [InfluxDB](https://hub.docker.com/_/influxdb/) image stores data in the `/var/lib/influxdb` directory in the container.
188
189 If persistence is enabled, a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) associated with StatefulSet is provisioned. The volume is created using dynamic volume provisioning. In case of a disruption (for example, a node drain), Kubernetes ensures that the same volume is reattached to the Pod, preventing any data loss. However, when persistence is **not enabled**, InfluxDB data is stored in an empty directory, so if a Pod restarts, data is lost.
190
191 ## Start with authentication
192
193 In `values.yaml`, change `.Values.config.http.auth-enabled` to `true`.
194
195 > **Note:** To enforce authentication, InfluxDB requires an admin user to be set up. For details, see [Set up authentication](https://docs.influxdata.com/influxdb/v1.2/query_language/authentication_and_authorization/#set-up-authentication).
196
197 To handle this set up during startup, enable a job in `values.yaml` by setting `.Values.setDefaultUser.enabled` to `true`.
198
199 Make sure to uncomment or configure the job settings after enabling it. If a password is not set, a random password will be generated.
200
201 Alternatively, if `.Values.setDefaultUser.user.existingSecret` is set the user and password are obtained from an existing Secret, the expected keys are `influxdb-user` and `influxdb-password`. Use this variable if you need to check in the `values.yaml` in a repository to avoid exposing your secrets.
202
203 ## Back up and restore
204
205 Before proceeding, please read [Backing up and restoring in InfluxDB OSS](https://docs.influxdata.com/influxdb/v1.7/administration/backup_and_restore/). While the chart offers backups by means of the [`backup-cronjob`](./templates/backup-cronjob.yaml), restores do not fall under the chart's scope today but can be achieved by one-off kubernetes jobs.
206
207 ### Backups
208
209 When enabled, the[`backup-cronjob`](./templates/backup-cronjob.yaml) runs on the configured schedule. One can create a job from the backup cronjob on demand as follows:
210
211 ```sh
212 kubectl create job --from=cronjobs/influxdb-backup influx-backup-$(date +%Y%m%d%H%M%S)
213 ```
214
215 #### Backup Storage
216
217 The backup process consists of an init-container that writes the backup to a
218 local volume, which is by default an `emptyDir`, shared to the runtime container
219 which uploads the backup to the configured object store.
220
221 In order to avoid filling the node's disk space, it is recommended to set a sufficient
222 `ephemeral-storage` request or enable persistence, which allocates a PVC.
223
224 Furthermore, if no object store provider is available, one can simply use the
225 PVC as the final storage destination when `persistence` is enabled.
226
227 ### Restores
228
229 It is up to the end user to configure their own one-off restore jobs. Below is just an example, which assumes that the backups are stored in GCS and that all dbs in the backup already exist and should be restored. It is to be used as a reference only; configure the init-container and the command and of the `influxdb-restore` container as well as both containers' resources to suit your needs.
230
231 ```yaml
232 apiVersion: batch/v1
233 kind: Job
234 metadata:
235   generateName: influxdb-restore-
236   namespace: monitoring
237 spec:
238   template:
239     spec:
240       volumes:
241         - name: backup
242           emptyDir: {}
243       serviceAccountName: influxdb
244       initContainers:
245         - name: init-gsutil-cp
246           image: google/cloud-sdk:alpine
247           command:
248             - /bin/sh
249           args:
250             - "-c"
251             - |
252               gsutil -m cp -r gs://<PATH TO BACKUP FOLDER>/* /backup
253           volumeMounts:
254             - name: backup
255               mountPath: /backup
256           resources:
257             requests:
258               cpu: 1
259               memory: 4Gi
260             limits:
261               cpu: 2
262               memory: 8Gi
263       containers:
264         - name: influxdb-restore
265           image: influxdb:1.7-alpine
266           volumeMounts:
267             - name: backup
268               mountPath: /backup
269           command:
270             - /bin/sh
271           args:
272             - "-c"
273             - |
274               #!/bin/sh
275               INFLUXDB_HOST=influxdb.monitoring.svc
276               for db in $(influx -host $INFLUXDB_HOST -execute 'SHOW DATABASES' | tail -n +5); do
277                 influxd restore -host $INFLUXDB_HOST:8088 -portable -db "$db" -newdb "$db"_bak /backup
278               done
279           resources:
280             requests:
281               cpu: 100m
282               memory: 128Mi
283             limits:
284               cpu: 500m
285               memory: 512Mi
286       restartPolicy: OnFailure
287 ```
288
289 At which point the data from the new `<db name>_bak` dbs would have to be side loaded into the original dbs.
290 Please see [InfluxDB documentation for more restore examples](https://docs.influxdata.com/influxdb/v1.7/administration/backup_and_restore/#restore-examples).
291
292 ## Mounting Extra Volumes
293
294 Extra volumes can be mounted by providing the `volumes` and `mountPoints` keys, consistent
295 with the behavior of other charts provided by Influxdata.
296
297 ```yaml
298 volumes:
299 - name: ssl-cert-volume
300   secret:
301     secretName: secret-name
302 mountPoints:
303 - name: ssl-cert-volume
304   mountPath: /etc/ssl/certs/selfsigned/
305   readOnly: true
306 ```
307
308 ## Upgrading
309
310 ### From < 1.0.0 To >= 1.0.0
311
312 Values `.Values.config.bind_address` and `.Values.exposeRpc` no longer exist. They have been replaced with `.Values.config.rpc.bind_address` and `.Values.config.rpc.enabled` respectively. Please adjust your values file accordingly.
313
314 ### From < 1.5.0 to >= 2.0.0
315
316 The Kubernetes API change to support 1.160 may not be backwards compatible and may require the chart to be uninstalled in order to upgrade.  See [this issue](https://github.com/helm/helm/issues/6583) for some background.
317
318 ### From < 3.0.0 to >= 3.0.0
319
320 Since version 3.0.0 this chart uses a StatefulSet instead of a Deployment. As part of this update the existing persistent volume (and all data) is deleted and a new one is created. Make sure to backup and restore the data manually.
321
322 ### From < 4.0.0 to >= 4.0.0
323
324 Labels are changed in accordance with [Kubernetes recommended labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/\#labels). This change also removes the ability to configure clusterIP value to avoid `Error: UPGRADE FAILED: failed to replace object: Service "my-influxdb" is invalid: spec.clusterIP: Invalid value: "": field is immutable` type errors. For more information on this error and why it's important to avoid this error, please see [this Github issue](https://github.com/helm/helm/issues/6378#issuecomment-582764215).
325
326 Due to the significance of the changes, we recommend uninstalling and reinstalling the chart (although the PVC shouldn't be deleted during this process, we highly recommended backing up your data beforehand).
327
328 Check out our [Slack channel](https://www.influxdata.com/slack) for support and information.