Skip to content

Allow TLS listeners to reference certificates by name without requiring a Kubernetes Secret #9421

Closed

Description

@wweiwei-li

Description

There are scenarios where TLS certificates are not stored as Kubernetes Secrets, but are instead resolved by name. Examples include:

  • Secrets pre-loaded in Envoy's bootstrap static resources, referenced by name
  • External data planes that resolve certificate identifiers at runtime

Today, Envoy Gateway requires every TLS Terminate listener to have certificateRefs pointing to a valid Kubernetes Secret. There is no way to tell Envoy Gateway "this cert will be resolved by name — just pass the identifier through to the xDS config."

Desired behavior

Allow a Gateway listener to specify an external certificate identifier and have Envoy Gateway:

  1. Accept the listener as valid without a Kubernetes Secret
  2. Pass the identifier through as the SDS secret name in the generated xDS DownstreamTlsContext

The expected generated xDS:

filter_chains:
- transport_socket:
    name: envoy.transport_sockets.tls
    typed_config:
      "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
      common_tls_context:
        tls_certificate_sds_secret_configs:
        - name: "certIdentifier"
          sds_config:
            ads: {}
            resource_api_version: V3

For multiple certificates per listener, the value should support multiple identifiers.

Possible approaches

We have a couple of options in mind but would appreciate guidance from the community on the best path forward:

Option 1: Support custom group/kind in certificateRefs that can be dynamically resolved by name

tls:
  mode: Terminate
  certificateRefs:
  - group: example.io
    kind: ExternalCertificate
    name: my-cert-identifier

Option 2: Use tls.options to carry the identifier

tls:
  mode: Terminate
  options:
    gateway.envoyproxy.io/external-certificate-ref: "certIdentifier"

That said, we're open to alternative approaches. If there's a better path to achieve this — whether through options, a new extension point, or something else — we'd be happy to explore that with the community.

Activity

  1. zirain commented on Jul 6, 2026

    @zirain
    Member

    we would support this as part of SDS ref secret like #8745, feel free to raise PR.

  2. wweiwei-li commented on Jul 6, 2026

    @wweiwei-li
    ContributorAuthor

    Hi @zirain, I'd like to contribute this. Thanks for the reference to #8745 . I think it matches what we need. Want to confirm the approach before I work on it.

    So basically, we need extend listener certificateRefs to accept secrets of type gateway.envoyproxy.io/sds

    User experience:

    apiVersion: v1
    kind: Secret
    metadata:
      name: my-sds-cert
    type: gateway.envoyproxy.io/sds
    stringData:
      secretName: "certIdentifier"
      url: "/var/run/sds-server/sds.sock"
    ---
    apiVersion: gateway.networking.k8s.io/v1
    kind: Gateway
    spec:
      listeners:
        - name: https
          protocol: HTTPS
          port: 443
          tls:
            mode: Terminate
            certificateRefs:
              - name: my-sds-cert
                kind: Secret
    

    Generated xDS:

    tls_certificate_sds_secret_configs:
      - name: "certIdentifier"
        sds_config:
          api_config_source:
            api_type: GRPC
            grpc_services:
              - envoy_grpc:
                  cluster_name: sds_var_run_sds-server_sds.sock
    

    Plus a static pipe cluster pointing to the SDS server's UDS path.

  3. wweiwei-li commented on Jul 6, 2026

    @wweiwei-li
    ContributorAuthor

    Also, regarding the SDS config — can we make it flexible to support different deployment models?

    Proposal:

    • With url (external SDS server): Generate sds_config with api_config_source pointing to a static pipe cluster. This is the general case above
    • For our special case, we would like to propose a gateway.envoyproxy.io/static-ref (name-only passthrough): A separate secret type that does not require URL that translates into just the name field without any sds_config. This is for external data planes where Envoy has custom logic to resolve the secret name internally.
    apiVersion: v1
    kind: Secret
    metadata:
      name: my-cert
    type: gateway.envoyproxy.io/static-ref
    stringData:
      secretName: "certIdentifier"
    

    Generated xDS:

    tls_certificate_sds_secret_configs:
    - name: "certIdentifier"
    
  4. zirain commented on Jul 6, 2026

    @zirain
    Member

    sounds good to me, want to hear other maintainers opinion, cc @envoyproxy/gateway-maintainers

  5. wweiwei-li commented on Jul 9, 2026

    @wweiwei-li
    ContributorAuthor

    Sure, I will bring this up during our meeting to hear other maintainer opinions.

    Our case:

    We would like to propose a gateway.envoyproxy.io/static-ref (name-only passthrough): A separate secret type that does not require URL that translates into just the name field without any sds_config. This is for external data planes where Envoy has custom logic to resolve the secret name internally.

    Details:

    1. Introduce a new secret type gateway.envoyproxy.io/static-ref that contains only a secretName field
    apiVersion: v1
    kind: Secret
    metadata:
      name: my-cert
    type: gateway.envoyproxy.io/static-ref
    stringData:
      secretName: "certIdentifier"
    
    1. When referenced by a Gateway listener's tls.certificateRefs, it generates xDS with just the name — no sds_config block, no cluster
    tls_certificate_sds_secret_configs:
    - name: "certIdentifier"
    
    1. A Separate flag enableStaticSecretRef

    Scope:

    Listener certs only as of now.

    Alternative considered:

    Make the url field optional in the existing gateway.envoyproxy.io/sds type — if URL is present, generate a full sds_config with a pipe cluster; if absent, emit name-only. However, I feel a separate types make the intent explicit and can gate on independent feature flag

  6. wweiwei-li commented on Jul 9, 2026

    @wweiwei-li
    ContributorAuthor

    This new secret type gateway.envoyproxy.io/static-ref benefits to where cert resolution happens outside the control plane's xDS.  cases like :

    
    # Bootstrap: define secrets statically
    static_resources:
      secrets:
        - name: server_cert
          tls_certificate:
            certificate_chain:
              filename: certs/servercert.pem
            private_key:
              filename: certs/serverkey.pem
    
      # Listener references it by name — no sds_config
      listeners:
        filter_chains:
          transport_socket:
            name: envoy.transport_sockets.tls
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
              common_tls_context:
                tls_certificate_sds_secret_configs:
                - name: server_cert    # ← name-only, no sds_config
               ```
    
  7. added
    kind/decision
    and removed on Jul 10, 2026
  8. zhaohuabing commented on Jul 10, 2026

    @zhaohuabing
    Member

    We discussed this during this week’s call, and there was agreement that this is a legitimate use case. The remaining question is whether it is common enough to benefit other open source users as part of the Gateway API surface.

    My suggestion is to use a dummy URL for now and wait a bit longer for more user input. If we see additional use cases and clearer requirements around this behavior, we can revisit and consider promoting it into the EG API.

  9. guydc commented on Jul 10, 2026

    @guydc
    Contributor

    My suggestion is to use a dummy URL for now

    Would this require any code change to ignore/adjust the dummy url?

  10. arkodg commented on Jul 12, 2026

    @arkodg
    Contributor

    im still unsure of the use case here, sounds like users want to link secrets populated by another entity ?
    can the workflow be similar to what cert-manager does https://cert-manager.io/docs/usage/gateway/ ?

    • user adds an annotation to the Gateway
      annotations:
        cert-manager.io/issuer: foo
    
    • links a secret without creating it
            certificateRefs:
              - name: example-com-tls
    
    • cert-manager populates that secret instead
  11. zhaohuabing commented on Jul 12, 2026

    @zhaohuabing
    Member

    My suggestion is to use a dummy URL for now

    Would this require any code change to ignore/adjust the dummy url?

    My assumption is that we don't need any code change on the EG side - cc @wweiwei-li

  12. wweiwei-li commented on Jul 12, 2026

    @wweiwei-li
    ContributorAuthor

    Hey, Thanks for all the discussion.

    1. Code change is needed on the EG side @zhaohuabing
      The existing gateway.envoyproxy.io/sds support from PR feat: add support for certificate fetching via SDS ref secret #8745 only works for backend certs. Extending it to listener level requires code changes regardless : validation in validateTerminateModeAndGetTLSSecrets, IR conversion, and xDS translation for DownstreamTlsContext. So even the "use a dummy URL" path requires a PR .

    2. Instead of dummy URL approach, how do you feel: Extend gateway.envoyproxy.io/sds to listener level, with url as optional

    • With url: Generate full sds_config with api_config_source pointing to a pipe cluster (existing behavior, now at listener level too)
    • Without url: Emit name-only SdsSecretConfig, no sds_config block, no cluster.
  13. wweiwei-li commented on Jul 12, 2026

    @wweiwei-li
    ContributorAuthor

    similar to what cert-manager does https://cert-manager.io/docs/usage/gateway

    @arkodg Hey, This is not our case. We don't want any controller to populate a Secret with cert material. Our use case is: pass a certificate name/identifier through to xDS so that Envoy can resolve it internally. The actual cert+key is delivered to Envoy through a separate out-of-band mechanism. The control plane only needs to say "use this cert by name," and Envoy ( external data plane) already knows how to find it

  14. zhaohuabing commented on Jul 15, 2026

    @zhaohuabing
    Member

    Code change is needed on the EG side @zhaohuabing
    The existing gateway.envoyproxy.io/sds support from PR #8745 only works for backend certs. Extending it to listener level requires code changes regardless : validation in validateTerminateModeAndGetTLSSecrets, IR conversion, and xDS translation for DownstreamTlsContext. So even the "use a dummy URL" path requires a PR .

    Yes, we should extend sds support to listener certs as well: #9009.

  15. wweiwei-li commented on Jul 16, 2026

    @wweiwei-li
    ContributorAuthor

    https://github.com/envoyproxy/envoy/blob/v1.24.2/api/envoy/extensions/transport_sockets/tls/v3/secret.proto#L35
    Name-only SdsSecretConfig (no sds_config) is explicitly defined behavior in here, since Envoy distinguishes the two modes by presence/absence of sds_config, and EG should be able to produce both

    • gateway.envoyproxy.io/static-ref
    • gateway.envoyproxy.io/sds
  16. github-actions commented on Aug 16, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had activity in the last 30 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/decisionkind/featurestale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions