{"id":37187171,"url":"https://github.com/influxdata/influxdata-operator","last_synced_at":"2026-01-14T21:44:37.183Z","repository":{"id":55440720,"uuid":"161215312","full_name":"influxdata/influxdata-operator","owner":"influxdata","description":"A k8s operator for InfluxDB","archived":true,"fork":false,"pushed_at":"2022-04-01T19:57:18.000Z","size":50146,"stargazers_count":76,"open_issues_count":11,"forks_count":32,"subscribers_count":38,"default_branch":"master","last_synced_at":"2024-08-17T01:10:37.330Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/influxdata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-10T17:57:23.000Z","updated_at":"2024-06-18T20:36:49.000Z","dependencies_parsed_at":"2022-08-15T00:20:39.217Z","dependency_job_id":null,"html_url":"https://github.com/influxdata/influxdata-operator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/influxdata/influxdata-operator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdata-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdata-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdata-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdata-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/influxdata","download_url":"https://codeload.github.com/influxdata/influxdata-operator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdata-operator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28436186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T21:32:52.117Z","status":"ssl_error","status_checked_at":"2026-01-14T21:32:33.442Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T21:44:36.383Z","updated_at":"2026-01-14T21:44:37.175Z","avatar_url":"https://github.com/influxdata.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"This repository has been archived and the work has been paused. If/when the\nwork starts again, it will continue here.\n\nTable of Contents\n=================\n   * [Development](#development)\n   * [InfluxDB Operator](#influxdb-operator)\n      * [Overview](#overview)\n      * [Usage](#usage)\n         * [Persistent Volumes](#persistent-volumes)\n         * [Deploy InfluxDB Operator \u0026amp; Create InfluxDB](#deploy-influxdb-operator--create-influxdb)\n            * [Destroy InfluxDB Cluster](#destroy-influxdb-cluster)\n            * [How to build \u0026amp; deploy your own operator docker image](#how-to-build--deploy-your-own-operator-docker-image)\n         * [Backup and Restore in AWS](#backup-and-restore-in-aws)\n            * [Create \"on-demand\" Backups \u0026amp; Store it in S3 Bucket](#create-on-demand-backups--store-it-in-s3-bucket)\n            * [Use backups to restore a database from S3 Bucket](#use-backups-to-restore-a-database-from-s3-bucket)\n         * [Backup and Restore in GCP](#backup-and-restore-in-gcp)\n            * [Create \"on-demand\" Backups \u0026amp; Store it in a GCS Bucket](#create-on-demand-backups--store-it-in-a-gcs-bucket)\n            * [Use backups to restore a database from GCS Bucket](#use-backups-to-restore-a-database-from-gcs-bucket)\n         * [Backup and Restore in Azure](#backup-and-restore-in-azure)\n            * [Create \"on-demand\" Backups \u0026amp; Store it in PV](#create-on-demand-backups--store-it-in-pv)\n            * [Use backups to restore a database](#use-backups-to-restore-a-database)\n            * [Manual Procedure for upsizing the Persistent Volume in Azure](#manual-procedure-for-upsizing-the-persistent-volume-in-azure)\n         * [Backup and Restore in OpenShift Container Platform (OCP)](#backup-and-restore-in-openshift-container-platform-ocp)\n            * [Overview of Persistent Volume support](#overview-of-persistent-volume-support)\n            * [Dynamic provisioning support](#dynamic-provisioning-support)\n            * [Expanding of Persistent Volume support in OCP](#expanding-of-persistent-volume-support-in-ocp)\n            * [Cluster installation](#cluster-installation)\n            * [StorageClass for NFS](#storageclass-for-nfs)\n            * [StorageClass for Ceph RBD](#storageclass-for-ceph-rbd)\n               * [limitation in Ceph RBD expanding](#limitation-in-ceph-rbd-expanding)\n            * [StorageClass for GlusterFS](#storageclass-for-glusterfs)\n            * [StorageClass for VSphere](#storageclass-for-vsphere)\n            * [Backup PV for OCP](#backup-pv-for-ocp)\n            * [Restore PV for OCP](#restore-pv-for-ocp)\n\n\n# Development\n\nClone the repository to a location on your workstation, generally this should be in someplace like `$GOPATH/src/github.com/`.\n\nNavigate to the location where the repository has been cloned and install the dependencies.\n\n```\ncd YOUR_REPO_PATH\ndep ensure\n```\n\n# InfluxDB Operator\n\nA Kubernetes operator to manage InfluxDB instances.\n\n## Overview\n\nThis Operator is built using the [Operator SDK](https://github.com/operator-framework/operator-sdk), which is part of the [Operator Framework](https://github.com/operator-framework/) and manages one or more InfluxDB instances deployed on Kubernetes.\n\n## Usage\n\nThe first step is to deploy a pvc backed by a persistent volume where the InfluxDB data will be stored. Next you will deploy one file that will install the Operator, and install the manifest for InfluxDB.\n\n### Persistent Volumes\n\nThe InfluxDB Operator supports the use of Persistent Volumes for each node in\nthe InfluxDB cluster.\n\nIf deploying on GKE clusters see [gcp_storageclass.yaml](deploy/gcp_storageclass.yaml).\n\nIf deploying on EKS clusters see [aws_storageclass.yaml](deploy/aws_storageclass.yaml).\n\nIf deploying on AKS clusters see [azure_storageclass.yaml](deploy/azure_storageclass.yaml).\n\nIf deploying on Local Workstation  see [local_storage.yaml](deploy/local_storage.yaml).\n\nPlease refer to the Openshift section for the storage on OCP (Openshift Container Platform). There are many types of storage class that OCP supports. \n\nThe storage class created by each file supports resize of the persistent volume. \nNote: Resize is only supported on Kubernetes 1.11 and higher. [Persistent Volume Resize](https://kubernetes.io/blog/2018/07/12/resizing-persistent-volumes-using-kubernetes/)\n\nTo create a storage class, \n```\nkubectl apply -f deploy/gcp-storageclass.yaml\n```\n\n### Deploy InfluxDB Operator \u0026 Create InfluxDB\n\nThe `bundle.yaml` file contains the manifests needed to properly install the\nOperator and InfluxDB. Please substitute `REPLACE_IMAGE` in `bundle.yaml` with the operator docker image url, \nthen run the following command,\n\n```\nkubectl apply -f bundle.yaml\n```\n\nYou can watch the list of pods and wait until the Operator pod is in a Running\nstate, it should not take long.\n\n```\nkubectl get pods \n```\n\nYou can have a look at the logs for troubleshooting if needed.\n\n```\nkubectl logs -l name=influxdata-operator\n```\n```\nkubectl logs -l name=influxdb-0\n```\n\nThis one file deploys the Operator, Service for InfluxDB, and create the manifest for InfluxDB. \n\n#### Destroy InfluxDB Cluster\n\nSimply delete the `InfluxDB` Custom Resource to remove the cluster.\n\n```\nkubectl delete -f bundle.yaml\n```\n\n#### How to build \u0026 deploy your own operator docker image\n\nAssumptions:\n* docker push access to your favorite docker registry is configured properly.\n* `operator-sdk` 0.0.7+ is installed on your workstation.\n\nIf the changes of the operator code are desired, `make deploy orgname=\u003cdocker_repo_name\u003e` performs the following steps:\n1. Build and push a new operator image with new tag.\n2. Update the `influxdata-operator` pod with the new operator image in the current kubernetes cluster associated with the current kubernetes context. `kubectl config current-context` can show the name of current kubernetes context. \n\n### Backup and Restore in AWS\n\n#### Create \"on-demand\" Backups \u0026 Store it in S3 Bucket\n\nThe backup CRD stores the backed up files to an S3 bucket. You first need to create a Kubernetes Secret for authenticating to AWS. Deploy the secret custom resource file [aws_creds.yaml](deploy/crds/influxdata_v1alpha1_aws_creds.yaml).\n\nNote : awsAccessKeyId \u0026 awsSecretAccessKey are `base64encoded`.\n\n```\napiVersion: v1\nkind: Secret\nmetadata:\n    name: influxdb-backup-s3\ntype: Opaque\ndata:\n    awsAccessKeyId: \u003cbase64encoded\u003e \n    awsSecretAccessKey: \u003cbase64encoded\u003e\n```\n\n```\nkubectl create -f deploy/crds/influxdata_v1alpha1_aws_creds.yaml\n```\n\nIn order to take a backup for one database, you need to specify the database name in Backup CR file [backup_cr.yaml](deploy/crds/influxdata_v1alpha1_backup_cr.yaml)\n\nThe below CR file will take a backup for \"testdb\" and store it in `s3://influxdb-backup-restore/backup/` `in US-WEST-2 Region`.\n\nTo backup all databases leave [databases:] blank.\n\n* Please see [InfluxDB OSS Backup](https://docs.influxdata.com/influxdb/v1.7/administration/backup_and_restore/#backup)\n* Please note the `provider` is set to `s3` as shown in the below yaml.\n```\napiVersion: influxdata.com/v1alpha1\nkind: Backup\nmetadata:\n  name: influxdb-backup\nspec:\n  podname: \"influxdb-0\"\n  containername: \"influxdb\"\n  # [ -database \u003cdb_name\u003e ] Optional: If not specified, all databases are backed up.\n  databases: \"testdb\"\n  # [ -shard \u003cID\u003e ] Optional: If specified, then -retention \u003cname\u003e is required.\n  shard:\n  # [ -retention \u003crp_name\u003e ] Optional: If not specified, the default is to use all retention policies. If specified, then -database is required.\n  retention:\n  # [ -start \u003ctimestamp\u003e ] Optional: Not compatible with -since.\n  start:\n  # [ -end \u003ctimestamp\u003e ] Optional:  Not compatible with -since. If used without -start, all data will be backed up starting from 1970-01-01.\n  end:\n  # [ -since \u003ctimestamp\u003e ] Optional: Use -start instead, unless needed for legacy backup support.\n  since:\n  storage:\n    provider: s3\n    s3:\n      aws_key_id:\n        valueFrom:\n          secretKeyRef:\n            name: influxdb-backup-s3\n            key: awsAccessKeyId\n      aws_secret_key:\n        valueFrom:\n          secretKeyRef:\n            name: influxdb-backup-s3\n            key: awsSecretAccessKey\n      bucket: influxdb-backup-restore \n      folder: backup\n      region: us-west-2\n\n```\n\n\n```\nkubectl create -f deploy/crds/influxdata_v1alpha1_backup_cr.yaml\n```\n\nYou can have a look at the logs for troubleshooting if needed.\n\n\n```\n kubectl logs influxdata-operator-5c97ffc89d-vc7nk\n```\n\nyou'll see something like this in logs 2018/11/14 18:17:03 Backups stored to s3://influxdb-backup-restore/backup/20181114181703 \n\n\nNote: 20181114181703 this is the directory name that stored the backup in S3 bucket . \n\n\n#### Use backups to restore a database from S3 Bucket\n\nYou need to specify the database name that you want to restore. If restoring from a multiple db backup, all db will be restored unless a db name is explicitly specified. \n\nEx : the yaml file below will restore the \"testdb\" database from s3://influxdb-backup-restore/backup/20181114181703. \n\n* Please see [InfluxDB OSS Restore](https://docs.influxdata.com/influxdb/v1.7/administration/backup_and_restore/#restore).\n* Please note the `provider` is set to `s3` as shown in the below yaml.\n  \n```\napiVersion: influxdata.com/v1alpha1\nkind: Restore\nmetadata:\n  name: influxdb-restore\nspec:\n  backupId: \"20181119213530\"\n  podname: \"influxdb-0\"\n  containername: \"influxdb\"\n  # [ -database \u003cdb_name\u003e ] Optional:  If not specified, all databases will be restored.\n  database: \"testdb\"\n  # [ -newdb \u003cnewdb_name\u003e ] Optional: If not specified, then the value for -db is used. \n  restoreTo: \n  # [ -rp \u003crp_name\u003e ] Optional: Requires that -db is set. If not specified, all retention policies will be used.\n  rp:\n  # [ -newrp \u003cnewrp_name\u003e ] Optional: Requires that -rp is set. If not specified, then the -rp value is used.\n  newRp:\n  # [ -shard \u003cshard_ID\u003e ] Optional: If specified, then -db and -rp are required.\n  shard:\n  storage:\n    provider: s3\n    s3:\n      aws_key_id:\n        valueFrom:\n          secretKeyRef:\n            name: influxdb-backup\n            key: awsAccessKeyId\n      aws_secret_key:\n        valueFrom:\n          secretKeyRef:\n            name: influxdb-backup\n            key: awsSecretAccessKey\n      bucket: influxdb-backup-restore \n      folder: backup\n      region: us-west-2\n\n```\n\n```\nkubectl create -f deploy/crds/influxdata_v1alpha1_restore_cr.yaml\n```\n\nYou can have a look at the logs for troubleshooting if needed.\n\n\n```\nkubectl logs influxdata-operator-5c97ffc89d-vc7nk\n```\n\n\n### Backup and Restore in GCP\n\n#### Create \"on-demand\" Backups \u0026 Store it in a GCS Bucket\n\nThe backup CRD stores the backed up files to a GCS bucket. You first need to create a Kubernetes Secret for authenticating to GCP. Deploy the secret custom resource file [gcp_sa.yaml](deploy/crds/influxdata_v1alpha1_gcp_sa.yaml).\n\nNote : the gcp service account is `base64encoded`.\n\nThere is a [helper script](scripts/create_gcs_sa.sh) that takes cares of creating a service account, granting the admin IAM role for the GCS bucket used for influxdb data, generating key in JSON, as well as outputting in a base64 encoded format.\n\n```\napiVersion: v1\nkind: Secret\nmetadata:\n  name: influxdata-backup-gcs\ntype: Opaque\ndata:\n  sa: \u003cbase64encoded\u003e\n```\n\n```\nkubectl create -f deploy/crds/influxdata_v1alpha1_gcp_sa.yaml\n```\n\nIn order to take a backup for one database, you need to specify the database name in Backup CR file [backup_cr.yaml](deploy/crds/influxdata_v1alpha1_backup_cr.yaml)\n\nThe below CR file will take a backup for \"testdb\" and store it in `s3://influxdb-backup-restore/backup/` `in US-WEST-2 Region`.\n\nTo backup all databases leave [databases:] blank.\n* Please see [InfluxDB OSS Backup](https://docs.influxdata.com/influxdb/v1.7/administration/backup_and_restore/#backup)\n* Please note the `provider` is set to `gcs` as shown in the below yaml.\n\n\n```\napiVersion: influxdata.com/v1alpha1\nkind: Backup\nmetadata:\n  name: influxdb-backup\nspec:\n  podname: \"influxdb-0\"\n  containername: \"influxdb\"\n  # [ -database \u003cdb_name\u003e ] Optional: If not specified, all databases are backed up.\n  databases: \"testdb\"\n  # [ -shard \u003cID\u003e ] Optional: If specified, then -retention \u003cname\u003e is required.\n  shard:\n  # [ -retention \u003crp_name\u003e ] Optional: If not specified, the default is to use all retention policies. If specified, then -database is required.\n  retention:\n  # [ -start \u003ctimestamp\u003e ] Optional: Not compatible with -since.\n  start:\n  # [ -end \u003ctimestamp\u003e ] Optional:  Not compatible with -since. If used without -start, all data will be backed up starting from 1970-01-01.\n  end:\n  # [ -since \u003ctimestamp\u003e ] Optional: Use -start instead, unless needed for legacy backup support.\n  since:\n  storage:\n    provider: gcs\n    gcs:\n      sa_json:\n        valueFrom:\n          secretKeyRef:\n            name: influxdb-backup-gcs\n            key: sa\n      bucket: influxdb-backup-restore\n      folder: backup\n```\n\n\n```\nkubectl create -f deploy/crds/influxdata_v1alpha1_backup_cr.yaml\n```\n\nYou can have a look at the logs for troubleshooting if needed.\n```\n kubectl logs influxdata-operator-76f9d76c57-r2vpd\n```\n\nyou'll see something like this in logs 2018/11/14 18:17:03 Backups stored to gs://influxdb-backup-restore/backup/20190105223039\n\n\nNote: 20190105223039 this is the directory name that stored the backup in GCS bucket . \n\n\n#### Use backups to restore a database from GCS Bucket\n\nYou need to specify the database name that you want to restore. If restoring from a multiple db backup, all db will be restored unless a db name is explicitly specified. \n\nEx : the yaml file below will restore the \"testdb\" database from gs://influxdb-backup-restore/backup/20190105223039. \n\n* Please see [InfluxDB OSS Restore](https://docs.influxdata.com/influxdb/v1.7/administration/backup_and_restore/#restore).\n* Please note the `provider` is set to `gcs` as shown in the below yaml.\n  \n\n```\napiVersion: influxdata.com/v1alpha1\nkind: Restore\nmetadata:\n  name: influxdb-restore\nspec:\n  backupId: \"20190105223039\"\n  podname: \"influxdb-0\"\n  containername: \"influxdb\"\n  # [ -database \u003cdb_name\u003e ] Optional:  If not specified, all databases will be restored.\n  database: \"testdb\"\n  # [ -newdb \u003cnewdb_name\u003e ] Optional: If not specified, then the value for -db is used. \n  restoreTo: \n  # [ -rp \u003crp_name\u003e ] Optional: Requires that -db is set. If not specified, all retention policies will be used.\n  rp:\n  # [ -newrp \u003cnewrp_name\u003e ] Optional: Requires that -rp is set. If not specified, then the -rp value is used.\n  newRp:\n  # [ -shard \u003cshard_ID\u003e ] Optional: If specified, then -db and -rp are required.\n  shard:\n  storage:\n    provider: gcs\n    gcs:\n      sa_json:\n        valueFrom:\n          secretKeyRef:\n            name: influxdb-backup-gcs\n            key: sa\n      bucket: influxdb-backup-restore\n      folder: backup\n\n```\n\n```\nkubectl create -f deploy/crds/influxdata_v1alpha1_restore_cr.yaml\n```\n\nYou can have a look at the logs for troubleshooting if needed.\n\n\n```\nkubectl logs influxdata-operator-76f9d76c57-r2vpd\n```\n\n### Backup and Restore in Azure\n\n#### Create \"on-demand\" Backups \u0026 Store it in PV\n\nThe backup CRD stores the backed up files to a PV(Persistent Volume) as an Azure Disk Storage.\n\nIn order to take a backup for one database, you need to specify the database name in Backup CR file [backup_cr_pv.yaml](deploy/crds/influxdata_v1alpha1_backup_cr_pv.yaml)\n\nThe below CR file will take a backup for \"testdb\" and store it in a Azure Disk storage `standard-resize`.\n\nTo backup all databases leave [databases:] blank.\n* Please see [InfluxDB OSS Backup](https://docs.influxdata.com/influxdb/v1.7/administration/backup_and_restore/#backup)\n* Please note the `provider` is set to `pv` as shown in the below yaml.\n\n```\napiVersion: influxdata.com/v1alpha1\nkind: Backup\nmetadata:\n  name: influxdb-backup\nspec:\n  podname: \"influxdb-0\"\n  containername: \"influxdb\"\n  # [ -database \u003cdb_name\u003e ] Optional: If not specified, all databases are backed up.\n  databases:\"testdb\"\n  # [ -shard \u003cID\u003e ] Optional: If specified, then -retention \u003cname\u003e is required.\n  shard:\n  # [ -retention \u003crp_name\u003e ] Optional: If not specified, the default is to use all retention policies. If specified, then -database is required.\n  retention:\n  # [ -start \u003ctimestamp\u003e ] Optional: Not compatible with -since.\n  start:\n  # [ -end \u003ctimestamp\u003e ] Optional:  Not compatible with -since. If used without -start, all data will be backed up starting from 1970-01-01.\n  end:\n  # [ -since \u003ctimestamp\u003e ] Optional: Use -start instead, unless needed for legacy backup support.\n  since:\n  storage:\n    provider: pv\n```\n\n```\nkubectl create -f deploy/crds/influxdata_v1alpha1_backup_cr_pv.yaml\n```\n\nYou can have a look at the logs for troubleshooting if needed.\n\n```\n kubectl logs influxdata-operator-64898d58f4-82lg8\n```\n\nyou'll see something like this in logs `2019/01/26 00:33:26 backing up db=NOAA_water_database rp=autogen shard=2 to /var/lib/influxdb/backup/20190126003326/NOAA_water_database.autogen.00002.00 since 0001-01-01T00:00:00Z`\n\n\nNote: 20190126003326 this is the directory name that stored the backup. \n\n\n#### Use backups to restore a database\n\n\nYou need to specify the database name that you want to restore. If restoring from a multiple db backup, all db will be restored unless a db name is explicitly specified. \n\nEx : the yaml file below will restore the \"testdb\" database from /var/lib//backup/20190126003326. \n\n* Please see [InfluxDB OSS Restore](https://docs.influxdata.com/influxdb/v1.7/administration/backup_and_restore/#restore).\n* Please note the `provider` is set to `pv` as shown in the below yaml.\n  \n\n```\n  apiVersion: influxdata.com/v1alpha1\nkind: Restore\nmetadata:\n  name: influxdb-restore\nspec:\n  backupId: \"20190126003326\"\n  podname: \"influxdb-0\"\n  containername: \"influxdb\"\n  # [ -database \u003cdb_name\u003e ] Optional:  If not specified, all databases will be restored.\n  database: testdb\n  # [ -newdb \u003cnewdb_name\u003e ] Optional: If not specified, then the value for -db is used. \n  restoreTo: \n  # [ -rp \u003crp_name\u003e ] Optional: Requires that -db is set. If not specified, all retention policies will be used.\n  rp:\n  # [ -newrp \u003cnewrp_name\u003e ] Optional: Requires that -rp is set. If not specified, then the -rp value is used.\n  newRp:\n  # [ -shard \u003cshard_ID\u003e ] Optional: If specified, then -db and -rp are required.\n  shard:\n  storage:\n    provider: pv\n```\n\n```\nkubectl create -f deploy/crds/influxdata_v1alpha1_restore_cr_pv.yaml\n```\n\nYou can have a look at the logs for troubleshooting if needed.\n\n```\nkubectl logs influxdata-operator-64898d58f4-82lg8\n\n2019/01/26 01:00:38 Restore DB: , To DB: , Backup key: 20190126003326\n2019/01/26 01:00:38 influxd restore -portable /var/lib/influxdb/backup/20190126003326\n```\n\n#### Manual Procedure for upsizing the Persistent Volume in Azure \nFirst of all, please make sure AKS version is *v1.11* up as resizing PV is beta after v1.11, according to https://kubernetes.io/blog/2018/07/12/resizing-persistent-volumes-using-kubernetes/. \n\nAs https://github.com/kubernetes/kubernetes/issues/68427 states,if the PVC is already attached to a VM, resize azure disk PVC would fail, you need to delete the pod to let that azure disk unattached first before upsizing on PV can take place. \nAs the Stateful will keep the influxdb pod's minimal size of 0, we can't simply just delete the pod. \nHere is a workaround. \n\n1. `kubectl edit sts influxdb` so that it uses a fake pvc name such as from `influxdb-data-pvc` to `influxdb-data-pvc-0`.\n2. Wait for `influxdb-0` in `pending` state, then `kubectl edit pvc influxdb-data-pvc` to increase PV size via pvc. \n3. Wait for the pv is updated with the new size, then `kubectl edit sts influxdb` and revert the pvc change made in step 1. \n4. `kubectl delete pod -l app=influxdb` will kill the pending pod and create a new influxdb pod that mounts with resized PV.\n5. `kubectl get pv,pvc` shows the both pv and pvc are updated with the new size.\n\n\n### Backup and Restore in OpenShift Container Platform (OCP)\n\n#### Overview of Persistent Volume support\n[Managing storage with Persistent Volume](https://docs.openshift.com/container-platform/3.11/install_config/persistent_storage/index.html) is a distinct problem from managing compute resources. OpenShift Container Platform uses the Kubernetes persistent volume (PV) framework to allow cluster administrators to provision persistent storage for a cluster. Developers can use persistent volume claims (PVCs) to request PV resources without having specific knowledge of the underlying storage infrastructure.\n\nOpenShift Container Platform supports many types PersistentVolume plug-ins. We highlight the following plugins. Furthermore there are many other plugins along with examples can be found from the OpenShift documentation.\n\n* [NFS](https://docs.openshift.com/container-platform/3.11/install_config/persistent_storage/persistent_storage_nfs.html#install-config-persistent-storage-persistent-storage-nfs)\n* [Ceph Rados Block Device(RBD)](https://docs.openshift.com/container-platform/3.11/install_config/persistent_storage/persistent_storage_ceph_rbd.html#install-config-persistent-storage-persistent-storage-ceph-rbd)\n* [GlusterFS](https://docs.openshift.com/container-platform/3.11/install_config/persistent_storage/persistent_storage_glusterfs.html#install-config-persistent-storage-persistent-storage-glusterfs)\n* [VMWare vSphere volumes](https://docs.openshift.com/container-platform/3.11/install_config/persistent_storage/persistent_storage_vsphere.html)\n\n\n#### Dynamic provisioning support\n[Dynamic provisioning and creating storage classes](https://docs.openshift.com/container-platform/3.11/install_config/persistent_storage/dynamically_provisioning_pvs.html#install-config-persistent-storage-dynamically-provisioning-pvs). The *StorageClass* resource object describes and classifies storage that can be requested, as well as provides a means for passing parameters for dynamically provisioned storage on demand. Please make sure to add the specified ansible variables during the cluster deployment. Ceph RBD, GlusterFS and VMWare provisioner support dynamic provisioning for OCP v3.11.\n\nIn the ansible inventory file (/etc/)\n```\n[OSEv3:vars]\n\nopenshift_master_dynamic_provisioning_enabled=True\n```\n\n#### Expanding of Persistent Volume support in OCP\n\nPlease note this feature is not turned on in OCP v3.11 by default. Please follow [Enabling Expansion of Persistent Volume](https://access.redhat.com/documentation/en-us/openshift_container_platform/3.11/html/developer_guide/expanding_persistent_volumes) on how to configure OCP to expand PV.  \n\nAccording to [OCP 3.11 release note](https://docs.openshift.com/container-platform/3.11/release_notes/ocp_3_11_release_notes.html), Block storage volume types such as GCE-PD, AWS-EBS, Azure Disk, Cinder, and Ceph RBD typically require a file system expansion before the additional space of an expanded volume is usable by pods. Kubernetes takes care of this automatically whenever the pod or pods referencing your volume are restarted. Network attached file systems, such as GlusterFS and Azure File, can be expanded without having to restart the referencing pod, as these systems do not require unique file system expansion.\n\n\n#### Cluster installation\nPlease make sure you have a valid Red Hat subscription and then follow the steps from [Installing Openshift Container Platform cluster](https://docs.openshift.com/container-platform/3.11/install/index.html).  *openshift-ansible* playbook is the key for installation and configuration of the cluster.\n\nHere is the cluster and OCP version we are using\n```\n$ oc version\noc v3.11.69\nkubernetes v1.11.0+d4cacc0\nfeatures: Basic-Auth GSSAPI Kerberos SPNEGO\n\nServer https://ocp-master-1.c.influx-db-operator.internal:8443\nopenshift v3.11.69\nkubernetes v1.11.0+d4cacc0\n```\n\n#### StorageClass for NFS\nPlease see [nfs_storage.yaml](deploy/nfs_storage.yaml). Only static provisioning is supported for NFS. \n\n```\noc describe pv influxdb-data-pv-nfs\nName:            influxdb-data-pv-nfs\nLabels:          \u003cnone\u003e\nAnnotations:     kubectl.kubernetes.io/last-applied-configuration={\"apiVersion\":\"v1\",\"kind\":\"PersistentVolume\",\"metadata\":{\"annotations\":{},\"name\":\"influxdb-data-pv-nfs\",\"namespace\":\"\"},\"spec\":{\"accessModes\":[\"ReadWri...\nFinalizers:      [kubernetes.io/pv-protection]\nStorageClass:    no-provisioner\nStatus:          Available\nClaim:\nReclaim Policy:  Retain\nAccess Modes:    RWO\nCapacity:        8Gi\nNode Affinity:   \u003cnone\u003e\nMessage:\nSource:\n    Type:      NFS (an NFS mount that lasts the lifetime of a pod)\n    Server:    nfs.openshift.example.com\n    Path:      /data\n    ReadOnly:  false\nEvents:        \u003cnone\u003e\n```\n\n#### StorageClass for Ceph RBD \n[Using Ceph RBD for dynamic provisioning](https://docs.openshift.com/container-platform/3.11/install_config/storage_examples/ceph_rbd_dynamic_example.html)\nPlease see [ceph_storage.yaml](deploy/ceph_storage.yaml).\n\n```\noc describe sc ceph-resize\nName:                  ceph-resize\nIsDefaultClass:        No\nAnnotations:           \u003cnone\u003e\nProvisioner:           kubernetes.io/rbd\nParameters:            adminId=admin,adminSecretName=ceph-secret,adminSecretNamespace=rook-ceph,fsType=ext4,imageFeatures=layering,imageFormat=2,monitors=172.30.89.136:6789,172.30.241.58:6789,172.30.249.2:6789,pool=kube,userId=kube,userSecretName=ceph-user-secret\nAllowVolumeExpansion:  \u003cunset\u003e\nMountOptions:          \u003cnone\u003e\nReclaimPolicy:         Delete\nVolumeBindingMode:     Immediate\n```\n##### limitation in Ceph RBD expanding\nWe ran into the known issue [resize pv failed](https://github.com/kubernetes/kubernetes/issues/72393) while expanding Ceph RBD. The bug fix would be part of future OCP releases.\n\n\n#### StorageClass for GlusterFS\n[Using GlusterFS for dynamic provisioning](https://docs.openshift.com/container-platform/3.11/install_config/persistent_storage/dynamically_provisioning_pvs.html#glusterfs)\nPlease see [glusterfs_storage.yaml](deploy/glusterfs_storage.yaml).\n\n\n#### StorageClass for VSphere\n[Using vSphere for dynamic provisioning](https://kubernetes.io/docs/concepts/storage/storage-classes/#vsphere)\nPlease see [vsphere_storage.yaml](deploy/vsphere_storage.yaml).\n\n\n#### Backup PV for OCP\nThe backup CRD stores the backed up files to a PV(Persistent Volume). \n\nIn order to take a backup for one database, you need to specify the database name in Backup CR file [backup_cr_pv.yaml](deploy/crds/influxdata_v1alpha1_backup_cr_pv.yaml)\n\nThe below CR file will backup all databases by leaving [databases:] blank.\n* Please see [InfluxDB OSS Backup](https://docs.influxdata.com/influxdb/v1.7/administration/backup_and_restore/#backup)\n* Please note the `provider` is set to `pv` as shown in the below yaml.\n  \n```\napiVersion: influxdata.com/v1alpha1\nkind: Backup\nmetadata:\n  name: influxdb-backup\nspec:\n  podname: \"influxdb-0\"\n  containername: \"influxdb\"\n  # [ -database \u003cdb_name\u003e ] Optional: If not specified, all databases are backed up.\n  databases:\n  # [ -shard \u003cID\u003e ] Optional: If specified, then -retention \u003cname\u003e is required.\n  shard:\n  # [ -retention \u003crp_name\u003e ] Optional: If not specified, the default is to use all retention policies. If specified, then -database is required.\n  retention:\n  # [ -start \u003ctimestamp\u003e ] Optional: Not compatible with -since.\n  start:\n  # [ -end \u003ctimestamp\u003e ] Optional:  Not compatible with -since. If used without -start, all data will be backed up starting from 1970-01-01.\n  end:\n  # [ -since \u003ctimestamp\u003e ] Optional: Use -start instead, unless needed for legacy backup support.\n  since:\n  storage:\n    provider: pv\n```\n\n```\nkubectl create -f deploy/crds/influxdata_v1alpha1_restore_cr_pv.yaml\n```\nYou can have a look at the logs for troubleshooting if needed.\n```\noc logs -f influxdata-operator-6788d5ffc5-m2d7r\n.....\n2019/02/12 20:39:18 backup complete:\n2019/02/12 20:39:18 \t/var/lib/influxdb/backup/20190212203917/20190212T203918Z.meta\n2019/02/12 20:39:18 \t/var/lib/influxdb/backup/20190212203917/20190212T203918Z.s1.tar.gz\n2019/02/12 20:39:18 \t/var/lib/influxdb/backup/20190212203917/20190212T203918Z.s2.tar.gz\n2019/02/12 20:39:18 \t/var/lib/influxdb/backup/20190212203917/20190212T203918Z.s3.tar.gz\n2019/02/12 20:39:18 \t/var/lib/influxdb/backup/20190212203917/20190212T203918Z.s4.tar.gz\n2019/02/12 20:39:18 \t/var/lib/influxdb/backup/20190212203917/20190212T203918Z.s5.tar.gz\n2019/02/12 20:39:18 \t/var/lib/influxdb/backup/20190212203917/20190212T203918Z.s6.tar.gz\n2019/02/12 20:39:18 \t/var/lib/influxdb/backup/20190212203917/20190212T203918Z.manifest\n2019/02/12 20:39:18 Done with reconcile!\n```\n\n#### Restore PV for OCP\n\nYou need to specify the database name that you want to restore. If restoring from a multiple db backup, all db will be restored unless a db name is explicitly specified. \n\nEx : the yaml file below restore all the  database from /var/lib//backup/20190212203917.\n\n* Please see [InfluxDB OSS Restore](https://docs.influxdata.com/influxdb/v1.7/administration/backup_and_restore/#restore).\n* Please note the `provider` is set to `pv` as shown in the below yaml.\n\n```\napiVersion: influxdata.com/v1alpha1\nkind: Restore\nmetadata:\n  name: influxdb-restore\nspec:\n  backupId: \"20190212203917\"\n  podname: \"influxdb-0\"\n  containername: \"influxdb\"\n  # [ -database \u003cdb_name\u003e ] Optional:  If not specified, all databases will be restored.\n  database: \n  # [ -newdb \u003cnewdb_name\u003e ] Optional: If not specified, then the value for -db is used. \n  restoreTo: \n  # [ -rp \u003crp_name\u003e ] Optional: Requires that -db is set. If not specified, all retention policies will be used.\n  rp:\n  # [ -newrp \u003cnewrp_name\u003e ] Optional: Requires that -rp is set. If not specified, then the -rp value is used.\n  newRp:\n  # [ -shard \u003cshard_ID\u003e ] Optional: If specified, then -db and -rp are required.\n  shard:\n  storage:\n    provider: pv\n```\n\nYou can have a look at the logs for troubleshooting if needed.\n```\noc logs -f influxdata-operator-6788d5ffc5-m2d7\n2019/02/12 20:49:01 Restore DB: , To DB: , Backup key: 20190212203917\n2019/02/12 20:49:01 influxd restore -portable /var/lib/influxdb/backup/20190212203917\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfluxdata%2Finfluxdata-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfluxdata%2Finfluxdata-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfluxdata%2Finfluxdata-operator/lists"}