Skip to content

K3s Features in k3d

K3s ships with lots of built-in features and services, some of which may only be used in “non-normal” ways in k3d due to the fact that K3s is running in containers.

General: K3s documentation


Cluster DNS service


CoreDNS in k3d

Basically, CoreDNS works the same in k3d as it does in other clusters. One thing to note though is, that the default forward . /etc/resolv.conf configured in the Corefile doesn’t work the same, as the /etc/resolv.conf file inside the K3s node containers is not the same as the one on your local machine.


As of k3d v5.x, k3d injects entries to the NodeHosts (basically a hosts file similar to /etc/hosts in Linux, which is managed by K3s) to enable Pods in the cluster to resolve the names of other containers in the same docker network (cluster network) and a special entry called host.k3d.internal which resolves to the IP of the network gateway (can be used to e.g. resolve DNS queries using your local resolver). There’s a PR in progress to make customizations easier (for k3d and for users):


Dynamically provisioning persistent local storage with Kubernetes


local-path-provisioner in k3d

In k3d, the local paths that the local-path-provisioner uses (default is /var/lib/rancher/k3s/storage) lies inside the container’s filesystem, meaning that by default it’s not mapped somewhere e.g. in your user home directory for you to use. You’d need to map some local directory to that path to easily use the files inside this path: add --volume $HOME/some/directory:/var/lib/rancher/k3s/[email protected] to your k3d cluster create command.


Kubernetes Ingress Controller


Traefik in k3d

k3d runs K3s in containers, so you’ll need to expose the http/https ports on your host to easily access Ingress resources in your cluster. We have a guide over here explaining how to do this:

servicelb (klipper-lb)

Embedded service load balancer in Klipper Allows you to use services with type: LoadBalancer in K3s by creating tiny proxies that use hostPorts


servicelb in k3d

klipper-lb creates new pods that proxy traffic from hostPorts to the service ports of type: LoadBalancer. The hostPort in this case is a port in a K3s container, not your local host, so you’d need to add the port-mapping via the --port flag when creating the cluster.

Last update: November 9, 2021
Back to top