Allow custom certSANs for KubeAPI to prevent certificate errors with Helm / Azure DevOps
- Dominant language
- PowerShell
- Stars
- 118
- Forks
- 63
- PR merge metrics
- No merged PRs in 30d
Description
**_tl;dr_** - Please provide a way to set custom hostnames for the KubeAPI certificate (ideally at k8s cluster creation time).
**Description**:
Assume you create a custom DNS entry for your KubeAPI endpoint: `k8s-api.contoso.com`. If you want to connect to your KubeAPI via this custom hostname (instead of IP), you'll run into the following error when deploying stuff via `helm upgrade`:
```
2021-05-27T19:39:14.0902588Z ##[error]Error: Kubernetes cluster unreachable: Get "https://k8s-api.contoso.com:6443/version?timeout=32s": x509: certificate is valid for kubernetes, kubernetes.default, kubernetes.default.svc, kubernetes.default.svc.cluster.local, moc-ltknu0w0kt4, not k8s-api.contoso.com
```
A real-life example of this happening is when configuring your AKS-on-HCI cluster as a Service Connection in Azure DevOps. By default, when we go to add the `KubeConfig` file to Azure DevOps for a Service Connection, we get this error:

Obviously they're doing some regex magic to verify the URL is legit. So the custom DNS entry above is the "correct" way to handle this. (FYI - The workaround is to **Accept untrusted certificates** and not verify... yuck!)
However, since Helm uses the raw settings directly from the `KubeConfig` specified here, it does not know to "ignore cert issues", nor does `--insecure-skip-tls-verify=true` in the `helm upgrade` command help :(
It would be awesome to have the ability to set a custom name to be added to the certificate at deployment - otherwise we need to jump thru a ton of hoops to recreate and redeploy KubeAPI and the cert.
Contributor guide
Assessment
This issue has not been assessed yet.