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.
ElasticsearchOpsRequest
What is ElasticsearchOpsRequest
ElasticsearchOpsRequest is a Kubernetes Custom Resource Definitions (CRD). It provides a declarative configuration for the Elasticsearch administrative operations like database version upgrading, horizontal scaling, vertical scaling, etc. in a Kubernetes native way.
ElasticsearchOpsRequest Specifications
Like any official Kubernetes resource, a ElasticsearchOpsRequest has TypeMeta, ObjectMeta, Spec and Status sections.
apiVersion: ops.kubedb.com/v1alpha1
kind: ElasticsearchOpsRequest
metadata:
name: es-upgrade
namespace: demo
spec:
type: UpdateVersion
databaseRef:
name: es
upgrade:
targetVersion: searchguard-7.5.2-v1
status:
conditions:
- lastTransitionTime: "2020-08-25T18:22:38Z"
message: Successfully completed the modification process
observedGeneration: 1
reason: Successful
status: "True"
type: Successful
observedGeneration: 1
phase: Successful
Here, we are going to describe the various sections of a ElasticsearchOpsRequest CRD.
spec.type
spec.type is a required field that specifies the kind of operation that will be applied to the Elasticsearch. The following types of operations are allowed in the ElasticsearchOpsRequest:
Restart- is used to perform a smart restart of the Elasticsearch cluster.Upgrade- is used to upgrade the version of the Elasticsearch in a managed way. The necessary information required for upgrading the version, must be provided inspec.upgradefield.VerticalScaling- is used to vertically scale the Elasticsearch nodes (ie. pods). The necessary information required for vertical scaling, must be provided inspec.verticalScalingfield.HorizontalScaling- is used to horizontally scale the Elasticsearch nodes (ie. pods). The necessary information required for horizontal scaling, must be provided inspec.horizontalScalingfield.VolumeExpansion- is used to expand the storage of the Elasticsearch nodes (ie. pods). The necessary information required for volume expansion, must be provided inspec.volumeExpansionfield.ReconfigureTLS- is used to configure the TLS configuration of a running Elasticsearch cluster. The necessary information required for reconfiguring the TLS, must be provided inspec.tlsfield.
Note: You can only perform one type of operation by using an
ElasticsearchOpsRequestcustom resource object. For example, if you want to upgrade your database and scale up its replica then you will need to create two separateElasticsearchOpsRequest. At first, you will have to create anElasticsearchOpsRequestfor upgrading. Once the upgrade is completed, then you can create anotherElasticsearchOpsRequestfor scaling. You should not create twoElasticsearchOpsRequestsimultaneously.
spec.databaseRef
spec.databaseRef is a required field that points to the Elasticsearch object for which the administrative operations will be performed. This field consists of the following sub-field:
databaseRef.name- specifies the name of the Elasticsearch object.
Note: The
ElasticsearchOpsRequestshould be on the same namespace as the referringElasticsearchobject.
spec.upgrade
spec.upgrade is an optional field, but it acts as a required field when the spec.type is set to Upgrade.
It specifies the desired version information required for the Elasticsearch version upgrade. This field consists of the following sub-fields:
upgrade.targetVersionrefers to an ElasticsearchVersion CR name that contains the Elasticsearch version information required to perform the upgrade.
KubeDB does not support downgrade for Elasticsearch.
Samples:
apiVersion: ops.kubedb.com/v1alpha1
kind: ElasticsearchOpsRequest
metadata:
name: es-topology-upgrade
namespace: demo
spec:
type: UpdateVersion
databaseRef:
name: es
upgrade:
targetVersion: searchguard-7.5.2-v1
spec.horizontalScaling
spec.horizontalScaling is an optional field, but it acts as a required field when the spec.type is set to HorizontalScaling.
It specifies the necessary information required to horizontally scale the Elasticsearch nodes (ie. pods). It consists of the following sub-field:
horizontalScaling.node- specifies the desired number of nodes for the Elasticsearch cluster running in combined mode (ie.Elasticsearch.spec.topologyisempty). The value should be greater than the maximum value of replication for the shard of any index. For example, if a shard hasxreplicas,x+1data nodes are required to allocate them.horizontalScaling.topology- specifies the desired number of different type of nodes for the Elasticsearch cluster running in cluster topology mode (ie.Elasticsearch.spec.topologyisnot empty).topology.master- specifies the desired number of master nodes. The value should be greater than zero ( >= 1 ).toplogy.ingest- specifies the desired number of ingest nodes. The value should be greater than zero ( >= 1 ).topology.data- specifies the desired number of data nodes. The value should be greater than the maximum value of replication for the shard of any index. For example, if a shard hasxreplicas,x+1data nodes are required to allocate them.
Samples:
Horizontally scale combined nodes:
apiVersion: ops.kubedb.com/v1alpha1 kind: ElasticsearchOpsRequest metadata: name: hscale-combined namespace: demo spec: type: HorizontalScaling databaseRef: name: es horizontalScaling: node: 4Horizontally scale cluster topology:
apiVersion: ops.kubedb.com/v1alpha1 kind: ElasticsearchOpsRequest metadata: name: hscale-topology namespace: demo spec: type: HorizontalScaling databaseRef: name: es horizontalScaling: topology: master: 2 ingest: 2 data: 3Horizontally scale only ingest nodes:
apiVersion: ops.kubedb.com/v1alpha1 kind: ElasticsearchOpsRequest metadata: name: hscale-ingest-nodes namespace: demo spec: type: HorizontalScaling databaseRef: name: es horizontalScaling: topology: ingest: 4
spec.verticalScaling
spec.verticalScaling is an optional field, but it acts as a required field when the spec.type is set to VerticalScaling. It specifies the necessary information required to vertically scale the Elasticsearch node resources (ie. cpu, memory). It consists of the following sub-field:
verticalScaling.node- specifies the desired node resources for the Elasticsearch cluster running in combined mode (ie.Elasticsearch.spec.topologyisempty).verticalScaling.topology- specifies the desired node resources for different type of node of the Elasticsearch running in cluster topology mode (ie.Elasticsearch.spec.topologyisnot empty).topology.master- specifies the desired resources for the master nodes. It takes input same as the k8s resources.topology.data- specifies the desired node resources for the data nodes. It takes input same as the k8s resources.topology.ingest- specifies the desired node resources for the ingest nodes. It takes input same as the k8s resources.
Note: It is recommended not to use resources below the default one;
cpu: 500m, memory: 1Gi.
Samples:
Vertically scale combined nodes:
apiVersion: ops.kubedb.com/v1alpha1 kind: ElasticsearchOpsRequest metadata: name: vscale-combined namespace: demo spec: type: VerticalScaling databaseRef: name: es verticalScaling: node: limits: cpu: 1000m memory: 2Gi requests: cpu: 500m memory: 1GiVertically scale topology cluster:
apiVersion: ops.kubedb.com/v1alpha1 kind: ElasticsearchOpsRequest metadata: name: vscale-topology namespace: demo spec: type: VerticalScaling databaseRef: name: es verticalScaling: topology: master: limits: cpu: 750m memory: 800Mi data: requests: cpu: 760m memory: 900Mi ingest: limits: cpu: 900m memory: 1.2Gi requests: cpu: 800m memory: 1GiVertically scale only data nodes:
apiVersion: ops.kubedb.com/v1alpha1 kind: ElasticsearchOpsRequest metadata: name: vscale-data-nodes namespace: demo spec: type: VerticalScaling databaseRef: name: es verticalScaling: topology: data: limits: cpu: 900m memory: 1.2Gi requests: cpu: 800m memory: 1Gi
spec.volumeExpansion
Note: To use the volume expansion feature the StorageClass must support volume expansion.
spec.volumeExpansion is an optional field, but it acts as a required field when the spec.type is set to VolumeExpansion. It specifies the necessary information required to expand the storage of the Elasticsearch node. It consists of the following sub-field:
volumeExpansion.node- specifies the desired size of the persistent volume for the Elasticsearch node running in combined mode (ie.Elasticsearch.spec.topologyisempty).volumeExpansion.topology- specifies the desired size of the persistent volumes for the different types of nodes of the Elasticsearch cluster running in cluster topology mode (ie.Elasticsearch.spec.topologyisnot empty).topology.master- specifies the desired size of the persistent volume for the master nodes.topology.data- specifies the desired size of the persistent volume for the data nodes.topology.ingest- specifies the desired size of the persistent volume for the ingest nodes.
All of them refer to Quantity types of Kubernetes.
Note: Make sure that the requested volume is greater than the current volume.
Samples:
Expand volume for combined nodes:
apiVersion: ops.kubedb.com/v1alpha1 kind: ElasticsearchOpsRequest metadata: name: volume-expansion-combined namespace: demo spec: type: VolumeExpansion databaseRef: name: es volumeExpansion: node: 4GiExpand volume for cluster topology:
apiVersion: ops.kubedb.com/v1alpha1 kind: ElasticsearchOpsRequest metadata: name: volume-expansion-topology namespace: demo spec: type: VolumeExpansion databaseRef: name: es volumeExpansion: topology: master: 2Gi data: 3Gi ingest: 4GiExpand volume for only data nodes:
apiVersion: ops.kubedb.com/v1alpha1 kind: ElasticsearchOpsRequest metadata: name: volume-expansion-data-nodes namespace: demo spec: type: VolumeExpansion databaseRef: name: es volumeExpansion: topology: data: 5Gi
spec.tls
The ReconfigureTLS only works with the Cert-Manager managed certificates. Installation guide.
spec.tls is an optional field, but it acts as a required field when the spec.type is set to ReconfigureTLS. It specifies the necessary information required to add or remove or update the TLS configuration of the Elasticsearch cluster. It consists of the following sub-fields:
tls.remove(bool|false) - tells the operator to remove the TLS configuration for the HTTP layer. The transport layer is always secured with certificates, so the removal process does not affect the transport layer.tls.rotateCertificates(bool|false) - tells the operator to renew all the certificates.tls.issuerRef- is anoptionalfield that references to theIssuerorClusterIssuercustom resource object of cert-manager. It is used to generate the necessary certificate secrets for Elasticsearch. If theissuerRefis not specified, the operator creates a self-signed CA and also creates necessary certificate (valid: 365 days) secrets using that CA.apiGroup- is the group name of the resource that is being referenced. Currently, the only supported value iscert-manager.io.kind- is the type of resource that is being referenced. The supported values areIssuerandClusterIssuer.name- is the name of the resource (IssuerorClusterIssuer) that is being referenced.
tls.certificates- is anoptionalfield that specifies a list of certificate configurations used to configure the certificates. It has the following fields:alias- represents the identifier of the certificate. It has the following possible value:transport- is used for the transport layer certificate configuration.http- is used for the HTTP layer certificate configuration.admin- is used for the admin certificate configuration. Available for theSearchGuardand theOpenDistroauth-plugins.metrics-exporter- is used for the metrics-exporter sidecar certificate configuration.
secretName- (string|"<database-name>-alias-cert") - specifies the k8s secret name that holds the certificates.subject- specifies anX.509distinguished name (DN). It has the following configurable fields:organizations([]string|nil) - is a list of organization names.organizationalUnits([]string|nil) - is a list of organization unit names.countries([]string|nil) - is a list of country names (ie. Country Codes).localities([]string|nil) - is a list of locality names.provinces([]string|nil) - is a list of province names.streetAddresses([]string|nil) - is a list of street addresses.postalCodes([]string|nil) - is a list of postal codes.serialNumber(string|"") is a serial number.
For more details, visit here.
duration(string|"") - is the period during which the certificate is valid. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as"300m","1.5h"or"20h45m". Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.renewBefore(string|"") - is a specifiable time before expiration duration.dnsNames([]string|nil) - is a list of subject alt names.ipAddresses([]string|nil) - is a list of IP addresses.uris([]string|nil) - is a list of URI Subject Alternative Names.emailAddresses([]string|nil) - is a list of email Subject Alternative Names.
To enable TLS on the HTTP layer, the configuration for the http layer certificate needs to be provided on tls.certificates[] list.
Samples:
Add TLS:
apiVersion: ops.kubedb.com/v1alpha1 kind: ElasticsearchOpsRequest metadata: name: add-tls namespace: demo spec: type: ReconfigureTLS databaseRef: name: es tls: issuerRef: apiGroup: "cert-manager.io" kind: Issuer name: es-issuer certificates: - alias: http subject: organizations: - kubedb.com emailAddresses: - [email protected]Remove TLS:
apiVersion: ops.kubedb.com/v1alpha1 kind: ElasticsearchOpsRequest metadata: name: remove-tls namespace: demo spec: type: ReconfigureTLS databaseRef: name: es tls: remove: trueRotate TLS:
apiVersion: ops.kubedb.com/v1alpha1 kind: ElasticsearchOpsRequest metadata: name: rotate-tls namespace: demo spec: type: ReconfigureTLS databaseRef: name: es tls: rotateCertificates: trueUpdate transport layer certificate:
apiVersion: ops.kubedb.com/v1alpha1 kind: ElasticsearchOpsRequest metadata: name: update-tls namespace: demo spec: type: ReconfigureTLS databaseRef: name: es tls: certificates: - alias: transport subject: organizations: - mydb.com # say, previously it was "kubedb.com"
ElasticsearchOpsRequest Status
.status describes the current state and progress of a ElasticsearchOpsRequest operation. It has the following fields:
status.phase
status.phase indicates the overall phase of the operation for this ElasticsearchOpsRequest. It can have the following three values:
| Phase | Meaning |
|---|---|
| Progressing | KubeDB has started to process the Ops request |
| Successful | KubeDB has successfully performed all the operations needed for the Ops request |
| Failed | KubeDB has failed while performing the operations needed for the Ops request |
status.observedGeneration
status.observedGeneration shows the most recent generation observed by the ElasticsearchOpsRequest controller.
status.conditions
status.conditions is an array that specifies the conditions of different steps of ElasticsearchOpsRequest processing. Each condition entry has the following fields:
typesspecifies the type of the condition.- The
statusfield is a string, with possible valuesTrue,False, andUnknown.statuswill beTrueif the current transition succeeded.statuswill beFalseif the current transition failed.statuswill beUnknownif the current transition was denied.
- The
messagefield is a human-readable message indicating details about the condition. - The
reasonfield is a unique, one-word, CamelCase reason for the condition’s last transition. - The
lastTransitionTimefield provides a timestamp for when the operation last transitioned from one state to another. - The
observedGenerationshows the most recent condition transition generation observed by the controller.
ElasticsearchOpsRequest has the following types of conditions:
| Type | Meaning |
|---|---|
Progressing | The operator has started to process the Ops request |
Successful | The Ops request has successfully executed |
Failed | The operation on the database failed |
OrphanStatefulSetPods | The statefulSet has deleted leaving the pods orphaned |
ReadyStatefulSets | The StatefulSet are ready |
ScaleDownCombinedNode | Scaled down the combined nodes |
ScaleDownDataNode | Scaled down the data nodes |
ScaleDownIngestNode | Scaled down the ingest nodes |
ScaleDownMasterNode | Scaled down the master nodes |
ScaleUpCombinedNode | Scaled up the combined nodes |
ScaleUpDataNode | Scaled up the data nodes |
ScaleUpIngestNode | Scaled up the ingest nodes |
ScaleUpMasterNode | Scaled up the master nodes |
UpdateCombinedNodePVCs | Updated combined node PVCs |
UpdateDataNodePVCs | Updated data node PVCs |
UpdateIngestNodePVCs | Updated ingest node PVCs |
UpdateMasterNodePVCs | Updated master node PVCs |
UpdateNodeResources | Updated node resources |






























