Local DNS via Traefik Ingress (ravikrs.local)#
What We Set Up#
A local DNS convention using /etc/hosts so all cluster services are reachable via hostname - no kubectl port-forward needed. Traefik (bundled with Rancher Desktop k3s) is the single ingress entrypoint.
| URL | Service |
|---|---|
http://argocd.ravikrs.local | ArgoCD UI |
http://sample-app.ravikrs.local | nginx sample app |
How It Works#
| |
Rancher Desktop binds the k3s Traefik LoadBalancer to 127.0.0.1:80 on your Mac. Any hostname you point at 127.0.0.1 in /etc/hosts will reach Traefik, which then routes to the correct Service based on the host: rule in the Ingress manifest.
Files in This Repo#
| |
The ArgoCD ingress is applied manually (ArgoCD can’t manage its own setup). The sample-app ingress is committed into the Kustomize base - ArgoCD will deploy it automatically on the next sync.
Step-by-Step Instructions#
1. Verify Traefik’s External IP#
| |
Expected output - look at EXTERNAL-IP:
| |
Important: The
EXTERNAL-IPshown (192.168.5.15) is Rancher Desktop’s internal VM IP. Your Mac canpingit but Chrome cannot reach TCP port 80 on it - that IP is not forwarded to the Mac host. Always use127.0.0.1in/etc/hostsregardless of whatEXTERNAL-IPshows.
2. Add /etc/hosts Entries#
Open /etc/hosts with sudo:
| |
Add these lines at the end - always use 127.0.0.1, not the EXTERNAL-IP from step 1:
| |
Save and exit (Ctrl+X, then Y).
Verify DNS resolution works:
| |
3. Configure ArgoCD to Serve Plain HTTP#
By default, argocd-server enforces TLS. Traefik will route HTTP (port 80) to it, so we need ArgoCD to accept plain HTTP connections. This is done via a ConfigMap flag - no deployment edits needed.
| |
Why
argocd-cmd-params-cm? This is the supported ArgoCD way to set server flags. It survives ArgoCD upgrades - unlike patching the Deployment’s args directly.
4. Apply the ArgoCD Ingress#
The Ingress manifest is at argocd/argocd-ingress.yaml in this repo. Apply it manually:
| |
Verify it was created:
| |
Expected:
| |
5. Test ArgoCD in the Browser#
Open: http://argocd.ravikrs.local
You should see the ArgoCD login page. Login with admin and the password from the initial install.
If you see a connection refused or Traefik 404 error, check:
kubectl get pods -n argocd- all pods Running?kubectl describe ingress argocd-server-ingress -n argocd- any events/errors?kubectl logs -n kube-system -l app.kubernetes.io/name=traefik- Traefik routing logs
6. Push the sample-app Ingress to Git#
The sample-app Ingress (config/sample-app/base/ingress.yaml) is already committed into the Kustomize base. Push to GitHub and ArgoCD will sync it automatically.
| |
After ArgoCD syncs (up to 3 minutes, or force with argocd app sync sample-app), verify:
| |
Then open: http://sample-app.ravikrs.local
Pattern for Future Apps#
Whenever you add a new app, follow this pattern:
- Add an
ingress.yamltoconfig/<app>/base/(copy fromconfig/sample-app/base/ingress.yaml, updatename,host, andport) - Add
- ingress.yamlto the app’skustomization.yaml - Add
127.0.0.1 <app>.ravikrs.localto/etc/hosts - Commit and push - ArgoCD deploys the Ingress automatically
Commands Reference#
| |
Gotchas#
- ArgoCD redirects HTTP → HTTPS by default. Without the
server.insecureflag, Traefik routes to port 80 but ArgoCD immediately redirects the browser tohttps://argocd.ravikrs.local, which won’t work for plain HTTP ingress. The ConfigMap patch above disables this. /etc/hostsis local only. Changes take effect immediately on your Mac but apply only to your machine. Other team members need to add the entries themselves.- Traefik
ingressClassName: traefikis required. k3s ships with Traefik as the default IngressClass. Without specifying it, some k3s versions ignore the Ingress. - ArgoCD manages sample-app Ingress, not its own. The
argocd/argocd-ingress.yamlfile is intentionally outside ofconfig/so ArgoCD doesn’t try to manage it. Apply it manually after any fresh ArgoCD install. - Port 80 must be free on your Mac. Rancher Desktop binds 127.0.0.1:80 to Traefik. If something else (Apache, nginx, another dev server) is using port 80, Traefik won’t bind and all ingresses will fail.
EXTERNAL-IPfromkubectl get svc traefikis the VM IP, not the Mac host IP. On Rancher Desktop (macOS), Traefik’s external IP (e.g.192.168.5.15) is on the Lima VM’s private network. Your Mac canpingit (ICMP routing is set up) but TCP port 80 is not forwarded from that IP to the Mac host. Always use127.0.0.1in/etc/hosts.- This behaviour changed in Rancher Desktop since ~2022. Older Rancher Desktop versions (QEMU + older Lima networking) made the VM IP directly reachable on TCP ports - you could put
192.168.x.xin/etc/hostsand it worked in the browser. Newer versions switched tosocket_vmnet+ Apple Virtualization framework, which no longer forwards TCP ports from the VM IP to the Mac host. Only127.0.0.1is explicitly forwarded now. If you followed an older guide or blog post that used the VM IP directly, this is why it no longer works.