Page MenuHomePhabricator

Ensure OpenSearch on k8s clusters can safely use envoy TLS termination
Closed, ResolvedPublic

Assigned To
Authored By
bking
Mar 6 2026, 8:38 PM
Referenced Files
F72754066: image.png
Mar 9 2026, 9:59 AM
F72753927: image.png
Mar 9 2026, 9:59 AM
F72753702: image.png
Mar 9 2026, 9:59 AM

Description

Per parent ticket, we are in the process of enabling envoy TLS termination on our OpenSearch clusters. This represents a large step forward in terms of observability and control at layer 7, but we there are also some risks. Creating this ticket to figure out:

  • How big is the performance penalty from double TLS termination? We aren't going to roll back just because of this, but we might consider beefing up our Envoy pods.

The penalty seems to be around 1m to 7ms, but it is not uniform.
It seems to be that any ingressgateway pod can do the TLS termination, including those running on nodes where there is no opensearch master pod running.
When the ingressgateway pod has analysed the payload and made a routing decision based on the HTTP request, this is then sent back to any opensearch master pod, which could be on another machine.

It might be possible to mitigate this by using the locality based load-balancing features of istio, with a sub-zone label on the pods to keep the upstream traffic to the same rack.

However, since the performance penalty is relatively small, this might not be necessary.

  • TLS Certificates
    • Will OpenSearch and/or Envoy refuse to connect when the pod certificates expire? Answer: yes The current version of the opensearch-cluster helm chart forces us to terminate TLS at the pod level. It also doesn't support hot reloading of certificates. If we put an Envoy-hosted certificate in front of the pods, our current TLS probes will no longer be able to see the expiration date of the pod certificates. Without monitoring, it's much more likely we'll forget to renew the certificates and cause an outage.
    • Does the new version of the chart force you to use TLS on the HTTP API like the old version? If not, we can disable TLS on the HTTP API (ref T414217 ) and avoid double TLS termination.

We should not roll out Envoy TLS termination to production clusters until we have satisfactory answers to the above questions.

Event Timeline

BTullis subscribed.

Looking at the blackbox probes for opensearch-test is interesting.
Since I enabled TLS termination at the ingressgateway for this cluster on Friday, we can see an impact on the time taken by different phases of the check.
https://grafana.wikimedia.org/goto/effhhxstkw6bkb?orgId=1

image.png (1,188×1,236 px, 502 KB)

Specifically:

  • The mean probe latency has increased from around 27ms to 34 ms

image.png (1,582×756 px, 122 KB)

image.png (948×504 px, 124 KB)

BTullis renamed this task from Ensure OpenSearch clusters can safely use envoy TLS termination to Ensure OpenSearch on k8s clusters can safely use envoy TLS termination.Mar 9 2026, 10:18 AM

Looking at the graphs above, we can see that the addition 6-7 ms is very spiky, but this probably represents an additional network hop between the ingressgateway and the backend service.

I'm going to see if there are any improvements we can make, based on keeping the envoy->opensearch conenctions warm and reusing them.

Change #1248865 had a related patch set uploaded (by Btullis; author: Btullis):

[operations/deployment-charts@master] opensearch-cluster: Terminate TLS on the ingress gateway

https://gerrit.wikimedia.org/r/1248865

With regard to the TLS certificate questions, this issue looks very relevant:
https://github.com/opensearch-project/opensearch-k8s-operator/issues/967

Currently, OpenSearch Operator enforces SSL by default, and there is no built-in option to disable it.
This can be problematic in scenarios where SSL is not required, such as local development, testing environments, or when OpenSearch is deployed in a secured private network where SSL termination is handled externally.

However, it looks like this only allows disabling TLS on the HTTP interface, not the transport interface.
These upstream issues explain why it can't yet be disabled on the transport interface:
https://github.com/opensearch-project/security/issues/4759
https://github.com/opensearch-project/security/issues/2414

The major concern pointed out here is that disabling Transport TLS has consequences for the logic around nodes joining the cluster securely.
A major feature of the security plugin is either the static nodes_dn setting in opensearch.yml or the dynamic nodes_dn.yml file which is part of the security index. In order for a node to join the cluster securely it must present a certificate that matches a known node_dn.

By my reading of this, we might be able to get rid of the additional latency penalty of a second TLS connection.
However, if we still need TLS certificates for the transport connection, then we potentially still have the same problem about expiry and hot-reloading.

BTullis triaged this task as High priority.Mar 9 2026, 11:48 AM

With regard to the TLS certificate questions, this issue looks very relevant:
https://github.com/opensearch-project/opensearch-k8s-operator/issues/967

Currently, OpenSearch Operator enforces SSL by default, and there is no built-in option to disable it.
This can be problematic in scenarios where SSL is not required, such as local development, testing environments, or when OpenSearch is deployed in a secured private network where SSL termination is handled externally.

However, it looks like this only allows disabling TLS on the HTTP interface, not the transport interface.

That's ok, we are only concerned with the HTTP interface. The transport interface is only used for intra-cluster communication and is not exposed anywhere else.

It looks like the certificate for opensearch-ipoid-test.svc.codfw.wmnet has expired, so I'll try deploying Envoy to that NS and see if it connects.

With regard to the TLS certificate questions, this issue looks very relevant:
https://github.com/opensearch-project/opensearch-k8s-operator/issues/967

Currently, OpenSearch Operator enforces SSL by default, and there is no built-in option to disable it.
This can be problematic in scenarios where SSL is not required, such as local development, testing environments, or when OpenSearch is deployed in a secured private network where SSL termination is handled externally.

However, it looks like this only allows disabling TLS on the HTTP interface, not the transport interface.

That's ok, we are only concerned with the HTTP interface. The transport interface is only used for intra-cluster communication and is not exposed anywhere else.

It looks like the certificate for opensearch-ipoid-test.svc.codfw.wmnet has expired, so I'll try deploying Envoy to that NS and see if it connects.

I suspect that this probably won't work, but we could add:

tls:
  mode: SIMPLE
  insecureSkipVerify: true

...to the DestinationRule.
That might be an acceptable solution until we can get the new version of the operator.

Am I correct in thinking that the new version of the operator supports hot-reloading of the certificates, so this problem goes away?

Envoy does enforce certificate validation:

curl https://opensearch-ipoid-test.svc.codfw.wmnet:30443/_cat/shards
upstream connect error or disconnect/reset before headers. retried and the latest reset reason: connection failure, transport failure reason: TLS error: 268435581:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED

I'll continue testing

Envoy does enforce certificate validation:

curl https://opensearch-ipoid-test.svc.codfw.wmnet:30443/_cat/shards
upstream connect error or disconnect/reset before headers. retried and the latest reset reason: connection failure, transport failure reason: TLS error: 268435581:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED

I'll continue testing

And does the insecureSkipVerify: true workaround work?

And does the insecureSkipVerify: true workaround work?

I haven't tried that. I rashly uninstalled the entire cluster, so we don't have an expired certificate to test against.

That being said, if insecureSkipVerify: true does work we could temporarily set that to unblock Semantic Search.

Another option: we could set up a separate OpenSearch CFSSL profile that issues longer-lived certificates (example) . The idea: we add an profile with a default 6- month certificate lifespan. There's almost zero chance we'll go 6 months without a new deploy in a production namespace, so we should be OK even without monitoring.

It's certainly possible to set up more than one CertManager clusterissuers.cfssl-issuer resource, but I'm not sure how that well it would fit with our integrations.

In theory, we could provision the new issuer and then turn "profile" into a list here . Then we could update the chart cert config to use the new issuer.

For monitoring the "inner" certificates, it's possible we could use 2 gateways: one terminating TLS and one keeping the current TLS approach. I'm not sure if that's feasible, but another thing to consider if we do decide monitoring is important.

I'm going to pursue the separate issuer approach for now, but we can move forward with insecureSkipVerify if everyone is OK with it.

Change #1251117 had a related patch set uploaded (by Bking; author: Bking):

[operations/puppet@production] dse-k8s: Add CFSSL profile for longer-lived certificates (6 mo).

https://gerrit.wikimedia.org/r/1251117

Change #1251117 merged by Bking:

[operations/puppet@production] dse-k8s: Add CFSSL profile for longer-lived certificates (6 mo).

https://gerrit.wikimedia.org/r/1251117

BTullis updated the task description. (Show Details)

A few updates:

  • We've deployed the TLS termination change above as a one-off to opensearch-semantic-search experimental namespaces, and we had an outage yesterday due to expired TLS certificates (as I predicted above).
  • We created a new CFSSL profile for longer-lived certificates, but the intermediate that signs certificates for that profile expires May 3rd. So we'll need to wait for IF to complete T420993 before we actually use the new profile.

Posting some potential solutions as suggested by my colleagues at today's standup:

  • Why not run a scheduled job to check certificate lifetimes?
  • There’s a service-checker template helper in the scaffold, try that?
  • We could monitor the certificate lifetime via certmanager metrics and alert on the difference between pod lifetime and certificate lifetime.

I provisioned opensearch-ipoid-test with the above change. Why?

Because opensearch-ipoid-test runs OpenSearch 2 (as opposed to all other OpenSearch clusters, which run OpenSearch 3). I wanted to know if the above changes would cause any problems with OpenSearch 2. I didn't see any problems, so it looks like we can run OpenSearch 2 with Envoy TLS termination.

That being said, we don't have an answer for the short-lived certificates yet, so we shouldn't deploy until we have the longer-lived certificates or we figure out monitoring.

Change #1248865 merged by Bking:

[operations/deployment-charts@master] opensearch-cluster: Terminate TLS on the ingress gateway

https://gerrit.wikimedia.org/r/1248865

Change #1265553 had a related patch set uploaded (by Bking; author: Bking):

[operations/deployment-charts@master] opensearch-ipoid: pin to chart version 0.0.17

https://gerrit.wikimedia.org/r/1265553

Change #1265553 merged by Bking:

[operations/deployment-charts@master] opensearch-ipoid: pin to chart version 0.0.17

https://gerrit.wikimedia.org/r/1265553

Change #1267100 had a related patch set uploaded (by Bking; author: Bking):

[operations/alerts@master] data-platform: Add alerts for opensearch on k8s certificate expiry

https://gerrit.wikimedia.org/r/1267100

Change #1267100 merged by Bking:

[operations/alerts@master] data-platform: Add alerts for opensearch on k8s certificate expiry

https://gerrit.wikimedia.org/r/1267100

Since we are now able to monitor and alert on the "inner" certificates' lifetimes, we can safely deploy Envoy TLS termination for all OpenSearch on k8s clusters. As such, I'm closing out this ticket.

Change #1268255 had a related patch set uploaded (by Bking; author: Bking):

[operations/alerts@master] opensearch-on-k8s: associate `OpenSearchCert` alerts with the correct prom instance

https://gerrit.wikimedia.org/r/1268255

Change #1268255 merged by Bking:

[operations/alerts@master] opensearch-on-k8s: associate `OpenSearchCert` alerts with the correct prom instance

https://gerrit.wikimedia.org/r/1268255