New to KubeDB? Please start here.
Elasticsearch License Activation
Elastic ships every distribution of Elasticsearch with the full X-Pack feature set built in, but most
of it (security, ILM, ML, and so on) only runs under a paid subscription or a trial license. There is
no separate “Enterprise” Docker image to switch to – activating a subscription is a runtime call
against the cluster’s _license API, not an image change. KubeDB lets you drive that activation
declaratively from the Elasticsearch CRO, or on demand via an ElasticsearchOpsRequest.
Before You Begin
You should be familiar with the following
KubeDBconcepts:License activation is only supported for the
ElasticStackdistribution (the upstream Elastic distribution). It is not applicable toOpenSearch,OpenDistro,SearchGuard, orKubeDBdistributionElasticsearchVersions, since none of those ship X-Pack’s commercial license model.
Two Ways to Activate a License
- Bring your own license (
secretRef): reference a Kubernetes Secret containing the signed license file you downloaded from Elastic, under keylicense.json. - Trial (
trial: true): ask the operator to activate Elastic’s built-in one-time 30-day trial license (POST _license/start_trial) instead. Elastic allows this exactly once per cluster; if the trial has already been used, the operator surfaces the failure via a condition instead of retrying forever.
Both are set on spec.license on the Elasticsearch object, and are mutually exclusive.
How License Activation Works
A user creates an
ElasticsearchCRO withspec.licenseset to eithersecretRefortrial.The KubeDB webhook validates the request:
spec.licenseis only accepted when the referencedElasticsearchVersionuses theElasticStackdistribution, exactly one ofsecretRef/trialis set, and (forsecretRef) the referenced Secret exists and carries alicense.jsonkey.Once the cluster is
Ready, the KubeDB Provisioner operator’s health-check loop readsspec.licenseon every pass and calls the cluster’s_licenseAPI to bring the installed license in line with it – installing/replacing it forsecretRef, or starting the trial fortrial.The operator records the outcome as
Conditionson theElasticsearchobject’s status:LicenseActive–Trueonce the cluster reports an active, non-basic license.Messagecarries the license type and expiry date.LicenseExpiringSoon–Truewhen the active license expires within 14 days. This is a warning only; the cluster staysReady.LicenseSyncFailed–Truewith the underlying API error inMessagewhen the operator could not read or apply the license (unreachable cluster, malformed Secret, a second trial request after the one-time trial was already consumed, and so on).
Because this reconcile is continuous, license state is self-healing: if the license is lost (a manual
DELETE _license, or a restore from an unlicensed snapshot), the next health-check pass re-applies it fromspec.licensewithout any user action.To rotate to a different license (a renewed BYO license, or to request the trial) without waiting for the next health-check pass, create an
ElasticsearchOpsRequestwithtype: RotateLicense. The KubeDB Ops-manager operator applies it immediately and patchesspec.licenseon theElasticsearchobject to match, so the CR stays the source of truth for future reconciles.
In the next section, we walk through activating a BYO license, requesting a trial, and rotating a
license with RotateLicense.
































