Public: anyone can read this; nobody can change it.

deploy/azure: k3s API cert missing public-IP SAN (PUBLIC_IP empty at install) #123

Closed opened this view on origin

Closed without the crew

opened this view on origin

Body:

What happened

Deployed via deploy/azure/main.bicep (single node, defaults, 2026-08-14). Germination succeeded, but the k3s API server cert has no public-IP SAN, so kubectl pointed at https://<public-ip>:6443 fails TLS verification:

x509: certificate is valid for 10.43.0.1, 10.60.0.10, 127.0.0.1, ::1, not 20.51.168.138

Actual SANs: DNS:benjivers.com, DNS:git.benjivers.com, DNS:kubernetes*, DNS:localhost, DNS:mitosis-leader, IP:10.43.0.1, IP:10.60.0.10, IP:127.0.0.1, IP:::1 — the domain SANs from --tls-san "$DOMAIN" made it in, the public IP did not.

Cause

lib/mitosis-node.sh line 79 guards with [ -n "$PUBLIC_IP" ], and on Azure PUBLIC_IP was empty at install time. The rendered k3s.service confirms: --tls-san benjivers.com --tls-san git.benjivers.com --node-ip 10.60.0.10 --tls-san 10.60.0.10 — no public IP. Either the Azure cloud-init template doesn't set PUBLIC_IP in node.env, or the IMDS lookup (which on Azure requires the Metadata: true header) returned empty and the guard silently swallowed it.

Impact

Low for the platform itself (Traefik-fronted services are unaffected), but any deployer following the "growing and tinkering" path can't use kubectl against the public endpoint without a workaround.

Workaround (no server changes): in the kubeconfig, keep server: https://<public-ip>:6443 and add tls-server-name: <domain> to the cluster entry — the domain SAN is present, so verification passes cleanly.

Suggested fix: populate PUBLIC_IP from Azure IMDS (curl -H "Metadata: true" "http://169.254.169.254/metadata/instance/network/interface/0/ipConfigurations/0/publicIpAddress?api-version=2021-02-01&format=text") in the cloud-init template, or fail loudly when it's empty instead of silently dropping the SAN. Worth checking whether the AWS/DO paths have the same silent-empty behavior.

commented

Fixed in #124 (merged): Azure IMDS leaves publicIpAddress empty for Standard-SKU IPs, so the SAN guard silently dropped it. The Bicep now bakes the static IP into node.env at render time (PUBLIC_IP=...), and mitosis-node.sh treats the env as authoritative with the IMDS probe as fallback — so redeploys get the SAN deterministically. For your existing node, no redeploy needed: add the SAN in place with --tls-san 20.51.168.138 appended to the k3s systemd unit args (or re-run the installer line with it) and restart k3s; the cert regenerates with the new SAN. Thanks for the precise report — the rendered-unit evidence made this a 10-minute fix.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs