Host Setup

Resolve the lab domain and trust the lab CAs on your machine

Three one-time steps on your machine make every lab URL open over HTTPS without warnings:

  1. Resolve the lab domain (lab.internal) through the DNS server on the storage node (192.168.56.20). ExternalDNS publishes every Istio Gateway host there, so there are no /etc/hosts edits.
  2. Trust two CAs: the lab CA (cert-manager; signs Grafana, Keycloak, Kiali, …) and the Vault CA (storage node; signs vault.lab.internal:8200).
  3. macOS only: allow apps other than Safari to reach the lab network.

When vagrant up finishes it exports both CAs to vagrant/certs/ (gitignored) and prints these exact commands with the CA fingerprints. Run them from the vagrant/ directory (the certificate paths are relative), one command per line. Each CA is removed before it is trusted, so the same commands also replace the CAs of a previous lab.

macOS

sudo mkdir -p /etc/resolver && echo "nameserver 192.168.56.20" | sudo tee /etc/resolver/lab.internal
security find-certificate -a -Z -c "k8s-lab-ca" /Library/Keychains/System.keychain | awk '/^SHA-1/{print $NF}' | xargs -I{} sudo security delete-certificate -Z {} /Library/Keychains/System.keychain
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain certs/k8s-lab-ca.crt
security find-certificate -a -Z -c "k8s-lab Vault CA" /Library/Keychains/System.keychain | awk '/^SHA-1/{print $NF}' | xargs -I{} sudo security delete-certificate -Z {} /Library/Keychains/System.keychain
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain certs/k8s-lab-vault-ca.crt

add-trusted-cert alone does not replace a CA with the same name, it adds another copy. Browsers cope, but Go clients such as kubelogin may pick a stale copy and fail with x509: ECDSA verification failure.

Then open System Settings → Privacy & Security → Local Network and enable your browser, terminal and IDE. Without it they fail with ERR_ADDRESS_UNREACHABLE / no route to host, even though Safari works (Apple apps are exempt). Fully quit (Cmd+Q) and reopen the browser.

Linux

Debian/Ubuntu with systemd-resolved; vboxnet0 is the VirtualBox host-only interface.

sudo resolvectl dns vboxnet0 192.168.56.20 && sudo resolvectl domain vboxnet0 '~lab.internal'
sudo cp certs/*.crt /usr/local/share/ca-certificates/ && sudo update-ca-certificates

resolvectl settings last until the interface goes down; to persist them use a NetworkManager/netplan DNS setting for the host-only interface. On Fedora/RHEL copy the certificates to /etc/pki/ca-trust/source/anchors/ and run sudo update-ca-trust.

Windows

Run in an admin PowerShell:

Add-DnsClientNrptRule -Namespace ".lab.internal" -NameServers "192.168.56.20"
certutil -delstore Root "k8s-lab-ca"; certutil -addstore -f Root certs\k8s-lab-ca.crt
certutil -delstore Root "k8s-lab Vault CA"; certutil -addstore -f Root certs\k8s-lab-vault-ca.crt

Check it

dscacheutil -q host -a name grafana.lab.internal   # macOS → ip_address: 192.168.56.200
getent hosts grafana.lab.internal                  # Linux
Resolve-DnsName grafana.lab.internal               # Windows
openssl x509 -in certs/k8s-lab-ca.crt -noout -fingerprint -sha256   # compare with the vagrant up output

To verify the chain from the command line (expected Verify return code: 0 (ok)):

echo | openssl s_client -connect grafana.lab.internal:443 -servername grafana.lab.internal \
  -CAfile certs/k8s-lab-ca.crt 2>/dev/null | grep "Verify return code"

Firefox keeps its own certificate store: either import the .crt files under Settings → Privacy & Security → Certificates → View Certificates → Authorities, or set security.enterprise_roots.enabled = true in about:config (macOS/Windows) to use the system store.

Why trusting the CA is required, not optional: Keycloak and Grafana send HSTS, so Chromium browsers (Brave, Chrome, Edge) refuse to “proceed anyway” on an untrusted certificate. Safari still lets you click through, which hides the problem.

After recreating the lab

vagrant destroy + vagrant up generates new CAs and a new cluster CA, so everything that trusted the old ones stops working until you:

  1. Re-run the host setup commands printed by vagrant up: they remove the old lab and Vault CAs and trust the new files in vagrant/certs/. On Linux, also drop the certificates of a lab that is gone with sudo rm /usr/local/share/ca-certificates/k8s-lab-*.crt && sudo update-ca-certificates --fresh before copying the new ones.
  2. Fetch the kubeconfigs again: both embed CAs. The admin one holds the old cluster CA, and the OIDC one holds the old lab CA in --certificate-authority-data, so kubelogin fails with x509: certificate signed by unknown authority even when the system trusts the new CA.
vagrant ssh controlplane -c 'sudo cat /etc/kubernetes/admin.conf' > ~/.kube/config-lab
vagrant ssh controlplane -c \
  'sudo k8s-provisioner vault get k8s-provisioner/kubeconfig-oidc config -c /etc/k8s-provisioner/config.yaml' \
  > ~/.kube/config-oidc

The DNS rule does not change and needs no action. Upgrading from a lab that used *.local names? Comment out or remove those lines in /etc/hosts.