Skip to content

Conversation

@allcontributors
Copy link
Contributor

Adds @anilamrute as a contributor for ideas, code.

This was requested by anilamrute in this comment

[skip ci]

@anilamrute
Copy link

## 💡 Fix: TLS SAN and Port Conflict when using a Custom Domain (demo.local)

**Issue:**
When creating a k3d cluster with a custom domain (like `demo.local`), users may see:

Unable to connect to the server: tls: failed to verify certificate: x509: certificate is valid for k3d-single-server-0, not demo.local


**Causes:**
- API port (6443) already in use  
- TLS SAN doesn’t include the custom domain  
- Hostname not resolvable locally  

**Fix:**
```bash
sudo lsof -i :6443
k3d cluster delete single
sudo nano /etc/hosts   # Add: 127.0.0.1 demo.local
k3d cluster create single \
  --servers 1 \
  --api-port demo.local:6445 \
  --k3s-arg "--tls-san=demo.local@server:0"
kubectl cluster-info

Result: The TLS SAN (demo.local) is now recognized and the cluster runs successfully.


Then commit and push:
```bash
git add docs/troubleshooting.md
git commit -m "docs: add fix for TLS SAN and port conflict (demo.local)"
git push origin fix-tls-san-docs

2️⃣ Create the Pull Request

Go to your fork → click “Compare & Pull Request”.

In the PR description, paste this text 👇

### 💡 Fix: TLS SAN and Port Conflict when using custom domain (demo.local)

This PR adds a troubleshooting section explaining how to fix the error:

tls: failed to verify certificate: x509: certificate is valid for k3d-single-server-0, not demo.local


**Includes:**
- Checking port conflicts
- Adding `demo.local` to `/etc/hosts`
- Recreating cluster with custom SAN and port

**Tested on:** macOS 10.15, Docker Desktop, k3d v5.8.3  
**Contributor:** @anilamrute  


/assign @anilamrute  

@all-contributors please add @anilamrute for doc and ideas

@allcontributors
Copy link
Contributor Author

@anilamrute

I've put up a pull request to add @fix! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants