Skip to content

SSL certificate verification fails when using Teleport Kubernetes proxy #495

@prein

Description

@prein

Describe the bug
KRR fails with SSL certificate verification errors when connecting to Kubernetes clusters through Teleport proxy, even though kubectl works correctly with the same kubeconfig. The Prometheus/Victoria Metrics connection works fine when specified with -p, but all Kubernetes API calls fail.

To Reproduce

  1. Configure Kubernetes access via Teleport (generates kubeconfig with tls-server-name)
  2. Verify kubectl get pods works
  3. Run krr simple -p <prometheus-url>
  4. See SSL verification errors on all Kubernetes API calls

Teleport kubeconfig structure:

clusters:
- cluster:
    certificate-authority-data: <base64-encoded-ca>
    server: https://company.teleport.sh:443
    tls-server-name: kube-teleport-proxy-alpn.company.teleport.sh
  name: company.teleport.sh

Error:

SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: 
unable to get local issuer certificate (_ssl.c:1006)'))

Expected behavior
KRR should respect the tls-server-name field from kubeconfig and successfully connect to the Kubernetes API through Teleport proxy, just like kubectl does.

Screenshots
N/A

Are you interested in contributing a fix for this?
Yes - happy to help test. May try working on a fix too, with AI help. The fix likely involves either:

  1. Upgrading kubernetes-client dependency to v28+ (has better tls-server-name support)
  2. Adding explicit tls-server-name handling in config_patch.py similar to proxy-url

Desktop (please complete the following information):

  • OS: macOS
  • KRR Version: 1.27.0 (Homebrew)
  • Python kubernetes-client bundled: 26.1.0

Additional context

  • The CERTIFICATE env var was tried with the base64-encoded CA from kubeconfig - KRR prints "added custom certificate" but still fails
  • Possible root cause: When Teleport is used, the server URL is https://company.teleport.sh:443 but TLS negotiation must use SNI kube-teleport-proxy-alpn.company.teleport.sh. The CA is valid for the SNI name, not the server hostname.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions