You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SSL certificate verification fails when using Teleport Kubernetes proxy #495
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
Configure Kubernetes access via Teleport (generates kubeconfig with tls-server-name)
Verify kubectl get pods works
Run krr simple -p <prometheus-url>
See SSL verification errors on all Kubernetes API calls
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:
Upgrading kubernetes-client dependency to v28+ (has better tls-server-name support)
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.
After analyzing the codebase, here's the recommended fix approach for tls-server-name support:
Root Cause
The config_patch.py file already handles proxy-url by extending the KubeConfigLoader class. The same pattern should be applied for tls-server-name to pass the SNI (Server Name Indication) to the SSL context.
Suggested Code Change for robusta_krr/core/integrations/kubernetes/config_patch.py:
# NOTE: This is a workaround for the issue described here:# https://github.com/kubernetes-client/python/pull/1863from __future__ importannotationsfromtypingimportOptionalfromkubernetes.clientimportconfigurationfromkubernetes.configimportkube_configclassKubeConfigLoader(kube_config.KubeConfigLoader):
def_load_cluster_info(self):
super()._load_cluster_info()
if"proxy-url"inself._cluster:
self.proxy=self._cluster["proxy-url"]
# Add tls-server-name support for Teleport and similar proxiesif"tls-server-name"inself._cluster:
self.tls_server_name=self._cluster["tls-server-name"]
def_set_config(self, client_configuration):
super()._set_config(client_configuration)
forkeyin ["proxy", "tls_server_name"]:
ifkeyinself.__dict__:
setattr(client_configuration, key, getattr(self, key))
classConfiguration(configuration.Configuration):
def__init__(
self,
proxy: Optional[str] =None,
tls_server_name: Optional[str] =None,
**kwargs,
):
super().__init__(**kwargs)
self.proxy=proxyself.tls_server_name=tls_server_nameconfiguration.Configuration=Configurationkube_config.KubeConfigLoader=KubeConfigLoader
Additional Notes
The tls_server_name attribute needs to be passed to the SSL context as the server_hostname parameter
You may also need to ensure the underlying urllib3 connection uses this SNI value
Testing with a Teleport-proxied cluster would be ideal
Activity
arikalon1 commentedon Jan 14, 2026
Proposed Fix Analysis
After analyzing the codebase, here's the recommended fix approach for
tls-server-namesupport:Root Cause
The
config_patch.pyfile already handlesproxy-urlby extending theKubeConfigLoaderclass. The same pattern should be applied fortls-server-nameto pass the SNI (Server Name Indication) to the SSL context.Suggested Code Change for
robusta_krr/core/integrations/kubernetes/config_patch.py:Additional Notes
tls_server_nameattribute needs to be passed to the SSL context as theserver_hostnameparameterurllib3connection uses this SNI valueCopilot has been assigned to work on this fix.