{"id":21470320,"url":"https://github.com/unboundedsystems/k3s-dind","last_synced_at":"2026-03-03T07:44:23.246Z","repository":{"id":39782334,"uuid":"186719384","full_name":"unboundedsystems/k3s-dind","owner":"unboundedsystems","description":"k3s - Lightweight Kubernetes inside a Docker-in-Docker container","archived":false,"fork":false,"pushed_at":"2024-05-01T20:00:12.000Z","size":167,"stargazers_count":42,"open_issues_count":0,"forks_count":20,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-02T13:58:31.247Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unboundedsystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-15T00:18:27.000Z","updated_at":"2024-05-01T20:00:15.000Z","dependencies_parsed_at":"2022-09-20T11:36:34.279Z","dependency_job_id":null,"html_url":"https://github.com/unboundedsystems/k3s-dind","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unboundedsystems%2Fk3s-dind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unboundedsystems%2Fk3s-dind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unboundedsystems%2Fk3s-dind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unboundedsystems%2Fk3s-dind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unboundedsystems","download_url":"https://codeload.github.com/unboundedsystems/k3s-dind/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226027288,"owners_count":17562132,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-23T09:26:54.950Z","updated_at":"2026-03-03T07:44:23.204Z","avatar_url":"https://github.com/unboundedsystems.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/unboundedsystems/k3s-dind/raw/master/k3s-dind.png\" /\u003e\u003c/p\u003e\n\n# k3s-dind\n\nLightweight k3s Kubernetes inside a Docker-in-Docker container\n\n## Quick Start\n\n```bash\ndocker run -d --privileged --name k3s --hostname k3s -p 8443:8443 unboundedsystems/k3s-dind\ndocker exec k3s get-kubeconfig.sh \u003e ./k3sconfig\nexport KUBECONFIG=./k3sconfig\n\nkubectl get nodes\nNAME      STATUS    ROLES     AGE       VERSION\nk3s       Ready     \u003cnone\u003e    1m        v1.14.1-k3s.4\n\nkubectl create ...\n\n```\n\n\n## What is k3s-dind?\n\nk3s-dind allows you to quickly create a [lightweight local Kubernetes cluster](https://k3s.io/),\nself-contained inside a single Docker-in-Docker (DinD) container.\n\n## What would I use it for?\n\nk3s-dind is awesome for:\n\n* Quickly running automated unit tests in Kubernetes\n* Running your containerized app locally for easier debugging\n* Testing out automation or changes to a Kubernetes cluster\n* Ensuring you're starting with a fresh cluster every time\n* Doing all that stuff in only 512MB of RAM!\n\n## Exposing network services\n\n### Docker host networking\n\nThe Quick Start example above uses Docker's [host networking](https://docs.docker.com/network/host/), using the `-p 8443:8443` option to `docker run` to expose the Kubernetes API port.\nTo run Kubernetes [services](https://kubernetes.io/docs/concepts/services-networking/service/) and make them available outside the cluster, you would need to use additional `-p` options to `docker run`, because Docker doesn't support exposing additional host networking ports after the container has been started.\n\nFor example, to allow your Docker host to connect to a [Kubernetes service running on port 8080](https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/), you'd need to start k3s-dind like this:\n\n```bash\ndocker run -d --privileged --name k3s --hostname k3s -p 8443:8443 -p 8080:8080 unboundedsystems/k3s-dind\n```\n\n### Docker named networks\n\nFor more dynamic environments, you can also use k3s-dind with named Docker networks, such as a [bridge network](https://docs.docker.com/network/bridge/).\nThen, any other containers on the same named network with k3s-dind can access any Kubernetes services exposed by the k3s-dind cluster.\n\nFirst, create a Docker network, then run k3s-dind attached to that network:\n\n```bash\ndocker network create mynetwork\ndocker run -d --privileged --name k3s --hostname k3s --network mynetwork unboundedsystems/k3s-dind\n\n# The second argument to get-kubeconfig.sh is the container name of k3s-dind\ndocker exec k3s get-kubeconfig.sh -yaml k3s \u003e ./k3sconfig\n```\n\nNow, any container on `mynetwork` can access any service exposed by the k3s-dind cluster:\n\n```bash\n# Run a container that's on mynetwork and mount the kubeconfig\ndocker run --rm -it -v ${PWD}/k3sconfig:/k3sconfig --network mynetwork k3integrations/kubectl\n\n# Now we're inside the container we just ran\nexport KUBECONFIG=/k3sconfig\n\nkubectl get all\nNAME             CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE\nsvc/kubernetes   10.43.0.1    \u003cnone\u003e        443/TCP   10m\n```\n\n### Changing k3s API server port\n\nThere are situations where you prefer to use port other than 8443 for k3s API server. For example, you want port 8443 to get ingress traffic, and to use port 6000 (for example) \nas the \"Kubernetes API port\". In this case you can use the `K3S_API_PORT` environment variable like this:\n\n```bash\ndocker run -d --privileged --name k3s --hostname k3s -p 8443:8443 -p 6000:6000 -e K3S_API_PORT=6000 unboundedsystems/k3s-dind\n```\n\n## You made Kubernetes that small??\n\nNope! The awesome folks over at [Rancher Labs](https://rancher.com/) did all\nthe hard work of creating [k3s](https://k3s.io/). We just packaged it into\na Docker-in-Docker container.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funboundedsystems%2Fk3s-dind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funboundedsystems%2Fk3s-dind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funboundedsystems%2Fk3s-dind/lists"}