Configuring OpenSearch TLS and Least-Privilege RBAC on Kubernetes
Enabling TLS for an OpenSearch cluster does not make it safe by itself. Transport traffic between nodes, REST API clients, and emergency admin work require different identities and permissions. Distributing one shared account and one certificate to every workload makes secret rotation, auditing, and permission reduction difficult at the same time.
This article designs the boundary of certificate authority → node/client/admin certificate → Secret mount → OpenSearch role in Kubernetes. Designing OpenSearch Hot/Cold Storage and Index Lifecycles on Kubernetes covered the storage and lifecycle foundation.
TLS and identity boundaries
Section titled “TLS and identity boundaries”From the OpenSearch Security plugin perspective, separate at least these roles.
| Identity | Path used | Required permission | Permission to deny |
|---|---|---|---|
| Node | transport, cluster join | node transport authentication | Dashboard login, document query |
| Ingestor | REST bulk write | create/write on designated indexes | cluster admin, delete-all |
| Reader | REST search | read/search on designated indexes | write, security administration |
| Break-glass admin | limited operational work | pre-approved admin operations | routine application use |
A certificate Subject DN expresses an authenticated principal; an OpenSearch role expresses an allowed action. Do not implicitly grant every permission from a DN. Keep trust rules for node and admin identities separate.
This identity split pairs directly with the node-pool boundaries drawn in the Hot/Cold Storage article. The collector in the application pool takes the Ingestor identity, Dashboards and query services take Reader, and OpenSearch Pods in the data and control pools take Node. Splitting pools while giving every workload the same account leaves only a scheduling boundary and no permission boundary.
Design certificate lifetime and rotation
Section titled “Design certificate lifetime and rotation”Automatically generated demo certificates, disabled hostname verification, and a long-lived key shared by every client can make initial startup easy, but must not become the operating default. In particular, tls.verify Off or disabled hostname verification trusts endpoints whose names do not match, weakening man-in-the-middle protection.
A recommended certificate inventory is below.
| Material | Location | Rotation impact |
|---|---|---|
| Root or intermediate CA | Strongly protected CA system | Trust-bundle overlap required |
| Node certificate/key | Node-specific Secret | Rolling restart and cluster-join validation |
| Client certificate/key | Per-workload Secret or external secret | Workload rollout |
| Admin certificate/key | Break-glass vault | Mount or fetch only for approved work |
Certificate expiration must be an Alert target. An overly short lifetime raises operational burden, while an overly long lifetime enlarges the key-compromise window. A rotation process covering CA issuance, overlap, revocation, and rollout matters more than fixing a value such as ten years.
Split rotation into issuing a new certificate and overlapping old/new CA trust, rolling out workloads that read the new material, verifying connections and peer DNs, and removing old trust. Changing the CA and all leaf certificates at once makes failure causes inseparable and increases the risk of cluster partition.
Separate Kubernetes Secrets and mounts
Section titled “Separate Kubernetes Secrets and mounts”Kustomize secretGenerator and External Secrets are delivery mechanisms for key material. A fixed Secret name can be useful, while a content-hashed name can trigger a rollout on change. Under either approach, never commit private keys as plaintext to Git.
apiVersion: v1kind: Secretmetadata: name: opensearch-node-tls namespace: search labels: app.kubernetes.io/part-of: search annotations: rotation.example.io/source: external-castringData: {}type: OpaqueThe actual Secret content is injected through an external-secret controller, sealed secret, or CI credential with a short lifetime. The stringData example shows only shape and contains no certificate or private key. Mounting the same Secret into nodes, ingestors, and readers destroys the least-privilege boundary.
When Helm values specify certificate paths, review the read-only mount, file permissions readable by the non-root process, and Pod security context together. A mode such as defaultMode: 0644 can be too broad for a private key. Match process UID/GID and file mode to the minimum scope, and prevent unnecessary sidecars from reading keys.
Design roles from principals and index boundaries
Section titled “Design roles from principals and index boundaries”Define a role from workload behavior rather than from an account name. A collector needs only writes to a Trace Data Stream; a query service needs reads and metadata access to that stream. A cluster-wide wildcard is the quickest solution, but it removes tenant/application separation and weakens audit value.
roles: trace_ingestor: cluster_permissions: - cluster_monitor index_permissions: - index_patterns: - "logs-integration-*" allowed_actions: - create_index - create_doc - index - write trace_reader: cluster_permissions: - cluster_monitor index_permissions: - index_patterns: - "logs-integration-*" allowed_actions: - read - search - indices:monitor/settings/getConfirm concrete action-group names against the OpenSearch Security plugin version in use. Do not copy the pseudo-role into production unchanged; validate real calls such as bulk ingest, Data Stream auto-create, template updates, and ISM APIs in integration tests. Template and policy change permissions should usually belong to a separate deployment principal, not the runtime ingestor.
Role mapping must avoid mixing human accounts and workload identities. Do not combine a person’s Dashboard query permission, automation’s policy-deployment permission, and a collector’s event-writing permission in one internal user. Prefer Kubernetes service accounts with OIDC or short-lived external credentials to static passwords; if a password is unavoidable, keep it only in a Secret and assign explicit rotation ownership.
Break-glass admin is an exception path
Section titled “Break-glass admin is an exception path”A reserved admin account can be required for initialization or recovery, but must not be used by applications or for daily Dashboard work. Break-glass access needs these controls.
- Issue the credential and admin certificate through a vault or approval path.
- Confirm security-configuration backup and target cluster health before the operation.
- Record the command, approver, executor, and result in audit logs.
- Revoke temporary material after completion and retain session evidence.
Putting a password hash in a document or runbook is not safe. Hashes are offline-cracking targets and, like plaintext passwords, tokens, and internal service URLs, must not remain in repositories or screenshots. Describe credential replacement only through secret reference and rotation command forms; handle real values in the vault.
Observe TLS and RBAC failures together
Section titled “Observe TLS and RBAC failures together”A security configuration is not verified merely because a deployment succeeds. Turn each failure below into a signal.
| Signal | Meaning | Action |
|---|---|---|
| Certificate expiry | Rotation window reached | Issue new leaf and plan rollout |
| TLS handshake failure | Trust, SAN, or protocol mismatch | Inspect peer certificate and client config |
| Authentication-failure surge | Stale credential or possible attack | Inspect principal, Secret version, audit log |
| Authorization denial | Role drift or over-privileged request | Compare requested action and role mapping |
| Admin action | Break-glass use | Verify change record and follow-up revoke |
Disabling verification or granting every client an admin role does not solve a TLS failure; it removes observability. Examine the denied action under a narrow role and add only the required permission. Correct SAN mismatch in certificate issuance or service DNS design.
Verification sequence
Section titled “Verification sequence”- Issue separate node, ingestor, and reader certificates under a fictional CA and non-production namespace.
- Confirm that node-certificate SANs match the OpenSearch node identity rule.
- Confirm that the ingestor can bulk-write while search and policy changes are denied.
- Confirm that the reader can search while write and security administration are denied.
- Roll out a new leaf certificate, revoke the old one, then inspect connectivity, audit events, and expiry metrics.
Summary
Section titled “Summary”OpenSearch TLS is not one encryption setting. It is the process by which nodes, clients, and admins establish trust with separate identities. A Kubernetes Secret is a key-material delivery path, not an authorization model; roles must start from a principal’s real actions and index boundary. When certificate rotation, authorization denials, and break-glass access are operating signals, TLS and RBAC become real failure boundaries rather than audit-only documentation.
Designing OpenSearch Cluster Monitoring and Incident Response next explains the Alerts and runbooks used to operate disk, shard, node, and index state in a cluster protected by these identity boundaries.