You are looking at the documentation of a prior release. To read the documentation of the latest release, please visit here.

New to KubeDB? Please start here.


What is ElasticsearchVersion

ElasticsearchVersion is a Kubernetes Custom Resource Definitions (CRD). It provides a declarative configuration to specify the docker images to be used for Elasticsearch, Kibana and OpenSearch, OpenSearch-Dashboards deployed with KubeDB in a Kubernetes native way.

When you install KubeDB, an ElasticsearchVersion custom resource will be created automatically for every supported Elasticsearch and OpenSearch version. You have to specify the name of ElasticsearchVersion CRD in spec.version field of Elasticsearch CRD. Then, KubeDB will use the docker images specified in the ElasticsearchVersion CRD to create your expected database. If you want to provision Kibana or Opensearch-Dashboards, you have to specify the name of Elasticsearch CRD in field of ElasticsearchDashboard CRD. Then, KubeDB will use the compatible docker image specified in the .spec.dashboard.image field of the ElasticsearchVersion CRD that Elasticsearch is using to create your expected dashboard.

Using a separate CRD for specifying respective docker images, and pod security policy names allow us to modify the images, and policies independent of the KubeDB operator. This will also allow the users to use a custom image for the database.

ElasticsearchVersion Specification

As with all other Kubernetes objects, an ElasticsearchVersion needs apiVersion, kind, and metadata fields. It also needs a .spec section.

kind: ElasticsearchVersion
  annotations: kubedb kubedb
  creationTimestamp: "2022-12-29T09:23:41Z"
  generation: 1
  labels: kubedb Helm kubedb-catalog v2022.12.28 kubedb-catalog-v2022.12.28
  name: xpack-8.11.1
  resourceVersion: "1844"
  uid: db8b5122-bce8-4e80-b608-e314954f2980
  authPlugin: X-Pack
    image: kibana:7.14.0
    yqImage: kubedb/elasticsearch-dashboard-init:7.14.0-xpack-v2022.02.22
    image: elasticsearch:7.14.0
  distribution: ElasticStack
    image: prometheuscommunity/elasticsearch-exporter:v1.3.0
    image: tianon/toybox:0.8.4
    yqImage: kubedb/elasticsearch-init:7.14.0-xpack-v2021.08.23
    databasePolicyName: elasticsearch-db
    runAsAnyNonRoot: true
    runAsUser: 1000
        name: elasticsearch-backup-7.3.2
          - name: args
            value: --match=^(?![.])(?!kubedb-system).+
        name: elasticsearch-restore-7.3.2
          - name: args
            value: --match=^(?![.])(?!kubedb-system).+
      - < 7.18.0
  version: 7.14.0 is a required field that specifies the name of the ElasticsearchVersion CRD. You have to specify this name in spec.version field of Elasticsearch CRD.

We follow this convention for naming ElasticsearchVersion CRD:

  • Name format: {Security Plugin Name}-{Application Version}-{Modification Tag}

  • Samples: xpack-8.11.1, xpack-8.11.1, opensearch-2.8.0, etc.

We use the original Elasticsearch docker image provided by the distributors. Then we bundle the image with the necessary sidecar and init container images which facilitate features like sysctl kernel settings, custom configuration, monitoring matrices, etc. An image with a higher modification tag will have more features and fixes than an image with a lower modification tag. Hence, it is recommended to use ElasticsearchVersion CRD with the highest modification tag to take advantage of the latest features.


spec.version is a required field that specifies the original version of the Elasticsearch database that has been used to build the docker image specified in spec.db.image field.


spec.deprecated is an optional field that specifies whether the docker images specified here is supported by the current KubeDB operator. For example, we have modified kubedb/elasticsearch:7.x.x-xpack docker images to support custom configuration and re-tagged as kubedb/elasticsearch:7.x.x-xpack-v1. Now, KubeDB operator version:x.y.z supports providing custom configuration which required kubedb/elasticsearch:7.x.x-xpack-v1 docker images. So, we have marked kubedb/elasticsearch:7.x.x-xpack as deprecated in KubeDB version:x.y.z.

The default value of this field is false. If spec.deprecated is set true, the KubeDB operator will not create the database and other respective resources for this version.


spec.db.image is a required field that specifies the docker image which will be used to create StatefulSet by KubeDB provisioner operator to create the expected Elasticsearch/OpenSearch database.


spec.dashboard.image is an optional field that specifies the docker image which will be used to create Deployment by KubeDB dashboard operator to create the expected Kibana/Opensearch-dashboards.


spec.exporter.image is a required field that specifies the image which will be used to export Prometheus metrics if monitoring is enabled.


updateConstraints specifies the constraints that need to be considered during version update. Here allowList contains the versions those are allowed for updating from the current version. An empty list of AllowList indicates all the versions are accepted except the denyList. On the other hand, DenyList contains all the rejected versions for the update request. An empty list indicates no version is rejected.


spec.podSecurityPolicies.databasePolicyName is a required field that specifies the name of the pod security policy required to get the database server pod(s) running.

helm upgrade -i kubedb oci:// \
  --namespace kubedb --create-namespace \
  --set additionalPodSecurityPolicies[0]=custom-db-policy \
  --set additionalPodSecurityPolicies[1]=custom-snapshotter-policy \
  --set-file global.license=/path/to/the/license.txt \
  --wait --burst-limit=10000 --debug


This holds the Backup & Restore task definitions, where a TaskRef has a Name & Params section. Params specifies a list of parameters to pass to the task.

Next Steps

  • Learn about Elasticsearch CRD here.
  • Deploy your first Elasticsearch database with KubeDB by following the guide here.
  • Deploy your first OpenSearch database with KubeDB by following the guide here.