I'll help you troubleshoot the localhost resolution issue in your Kind cluster on Podman. Let me search for the most current information about this specific setup.
Based on my research, this is a known issue with Podman on Linux. The host.containers.internal and host.docker.internal entries are not being reliably added to /etc/hosts in Kind clusters. Here are the main solutions:
The issue is often related to Podman's network backend. Try changing from pasta to slirp4netns:
Edit your ~/.config/containers/containers.conf file:
[network]
default_rootless_network_cmd = "slirp4netns"Then restart your Kind cluster.
Add the host entries manually when creating your Kind cluster:
kind create cluster --config kind-config.yamlCreate a kind-config.yaml:
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 30000
hostPort: 30000
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"For Podman 5.0+, the default network backend changed. You can also try:
# Check your current network backend
podman info --debug | grep -i network
# If using pasta, try switching to slirp4netns
podman network create kind-network
kind create cluster --network kind-networkAs a workaround, find your host's IP and use it directly:
# Get your host IP
ip route show default | awk '{print $3}'
# Or use this in your pods
curl http://$(ip route show default | awk '{print $3}'):8080Create a custom DNS configuration:
# Create a custom resolv.conf
echo "nameserver 8.8.8.8" > custom-resolv.conf
echo "nameserver 8.8.4.4" >> custom-resolv.conf
# Run Kind with custom DNS
podman run --rm -v $(pwd)/custom-resolv.conf:/etc/resolv.conf:Z kind create clusterAfter applying any of these solutions, test the resolution:
# Create a test pod
kubectl run test --image=busybox --rm -it -- sh
# Inside the pod, test:
nslookup host.containers.internal
# or
nslookup host.docker.internalThe network backend change (solution #1) has been the most successful for users experiencing this exact issue. Would you like me to help you implement any of these solutions?