{"id":16442288,"url":"https://github.com/nolar/setup-k3d-k3s","last_synced_at":"2025-03-16T17:36:32.330Z","repository":{"id":46560707,"uuid":"317023606","full_name":"nolar/setup-k3d-k3s","owner":"nolar","description":"Setup K3d/K3s for GitHub Actions","archived":false,"fork":false,"pushed_at":"2022-11-01T00:10:25.000Z","size":37,"stargazers_count":82,"open_issues_count":6,"forks_count":12,"subscribers_count":3,"default_branch":"v1","last_synced_at":"2024-10-14T20:01:54.881Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nolar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":"FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"nolar"}},"created_at":"2020-11-29T19:09:29.000Z","updated_at":"2024-10-04T18:03:43.000Z","dependencies_parsed_at":"2023-01-11T17:22:54.700Z","dependency_job_id":null,"html_url":"https://github.com/nolar/setup-k3d-k3s","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":"0.10526315789473684","last_synced_commit":"293b8e5822a20bc0d5bcdd4826f1a665e72aba96"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nolar%2Fsetup-k3d-k3s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nolar%2Fsetup-k3d-k3s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nolar%2Fsetup-k3d-k3s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nolar%2Fsetup-k3d-k3s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nolar","download_url":"https://codeload.github.com/nolar/setup-k3d-k3s/tar.gz/refs/heads/v1","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221019319,"owners_count":16740105,"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-10-11T09:16:53.448Z","updated_at":"2024-10-27T11:02:04.697Z","avatar_url":"https://github.com/nolar.png","language":"Shell","funding_links":["https://github.com/sponsors/nolar"],"categories":["Shell"],"sub_categories":[],"readme":"# Setup K3d/K3s for GitHub Actions\n\nInstall K3d/K3s and start a local Kubernetes cluster of a specific version.\n\n**K8s** is Kubernetes.\n**K3s** is a lightweight K8s distribution.\n**K3d** is a wrapper to run K3s in Docker.\n\nK3d/K3s are especially good for development and CI purposes, as it takes\nonly 20-30 seconds of time till the cluster is ready. For comparison,\nKind takes 1.5 minutes, Minikube takes 2 minutes till ready (as of Sep'2020).\n\n\n## Quick start\n\nStart with the simplest way:\n\n```yaml\njobs:\n  some-job:\n    steps:\n      - uses: nolar/setup-k3d-k3s@v1\n```\n\nChange versions with the verbose way:\n\n```yaml\njobs:\n  some-job:\n    steps:\n      - uses: nolar/setup-k3d-k3s@v1\n        with:\n          version: v1.21  # E.g.: v1.21, v1.21.2, v1.21.2+k3s1\n          github-token: ${{ secrets.GITHUB_TOKEN }}\n```\n\n\n## Inputs\n\n### `version`\n\n**Required** version of Kubernetes and/or K3s -- either full or partial.\n\nThe following notations are supported:\n\n* `v1.21.2+k3s1`\n* `v1.21.2`\n* `v1.21`\n* `v1`\n* `latest`\n\nDefaults to `latest`.\n\nKeep in mind that K3d dates back only to v1.16.\nThere are no 1.15 and older versions of K8s.\nBesides, 1.16 and 1.17 are broken and will not be fixed\n(see [#11](https://github.com/nolar/setup-k3d-k3s/issues/11)).\n\nWhen the version is partial, the latest detected one will be used,\nas found in [K3s releases](https://github.com/k3s-io/k3s/releases),\naccording to the basic semantical sorting (i.e. not by time of releasing).\n\n\n### `k3d-tag`\n\nA tag/version of K3d to use. Corresponds to GitHub tags at\nhttps://github.com/rancher/k3d/releases. For example, `v5.0.0`.\n`latest` is also accepted, but converted to an empty string\nfor the installation script.\n\nBy default (i.e. if no value is provided), the latest version is used.\n\n\n### `k3d-name`\n\nA name of the cluster to be created.\n\nBy default (i.e. if no value is provided), K3d/K3s define their own name.\nUsually it is `k3d-k3s-default`.\n\nNote: the name should not include the `k3d-` prefix, but must be used with it.\nThe `k3d-` prefix is enforced by K3d and cannot be disabled.\n\n\n### `k3d-args`\n\nAdditional args to pass to K3d.\nSee `k3d cluster create --help` for available flags.\n\n\n### `github-token`\n\nA token for GitHub API, which is used to avoid rate limiting.\n\nThe API is used to fetch the releases from the K3s repository.\n\nBy default, or if it is empty, then the API is accessed anonymously,\nwhich implies the limit of approximately 60 requests / 1 hour / 1 worker.\n\nUsage:\n\n```yaml\nwith:\n  github-token: ${{ secrets.GITHUB_TOKEN }}\n```\n\n\n### `skip-creation`\n\nWhether to return from the action as soon as possible\nwithout the cluster creation (the cluster readiness is also skipped).\nThis can be useful to only install the tools for manual cluster creation,\nor to parse the available versions and return them as the action's outputs.\n\nBy default (`false`), the cluster is created.\n\n\n### `skip-readiness`\n\nWhether to return from the action as soon as possible,\npossibly providing a cluster that is only partially ready.\n\nBy default (`false`), the readiness is awaited by checking for some preselected\nresources to appear (e.g., for a service account named \"default\").\n\n\n## Outputs\n\n### `k3d-version`\n\nThe specific K3d version that was detected and used. E.g. `v5.0.0`.\n\n\n### `k3s-version`\n\nThe specific K3s version that was detected and used. E.g. `v1.21.2+k3s1`.\n\n\n### `k8s-version`\n\nThe specific K8s version that was detected and used. E.g. `v1.21.2`.\n\n\n## Examples\n\nWith the latest version of K3d/K3s/K8s:\n\n```yaml\nsteps:\n  - uses: nolar/setup-k3d-k3s@v1\n```\n\nWith the specific minor version of K8s, which implies the latest micro version\nof K8s and the latest possible version of K3s:\n\n```yaml\nsteps:\n  - uses: nolar/setup-k3d-k3s@v1\n    with:\n      version: v1.21\n```\n\nWith the very specific version of K3s:\n\n```yaml\nsteps:\n  - uses: nolar/setup-k3d-k3s@v1\n    with:\n      version: v1.21.2+k3s1\n```\n\nThe partial versions enable the build matrices with only the essential\ninformation in them, which in turn, makes it easier to configure GitHub\nbranch protection checks while the actual versions of tools are upgraded:\n\n```yaml\njobs:\n  some-job:\n    strategy:\n      fail-fast: false\n      matrix:\n        k8s: [ v1.21, v1.20, v1.19, v1.18 ]\n    name: K8s ${{ matrix.k8s }}\n    runs-on: ubuntu-22.04\n    steps:\n      - uses: nolar/setup-k3d-k3s@v1\n        with:\n          version: ${{ matrix.k8s }}\n```\n\nMultiple clusters in one job are possible, as long as there is enough memory\n(note: `k3d-` prefix is enforced by K3d):\n\n```yaml\njobs:\n  some-job:\n    name: Multi-cluster\n    runs-on: ubuntu-22.04\n    steps:\n      - uses: nolar/setup-k3d-k3s@v1\n        with:\n          version: v1.20\n          k3d-name: 1-20\n      - uses: nolar/setup-k3d-k3s@v1\n        with:\n          version: v1.21\n          k3d-name: 1-21\n      - run: kubectl version --context k3d-1-20 \n      - run: kubectl version --context k3d-1-21 \n```\n\nCustom version of K3d can be used, if needed:\n\n```yaml\njobs:\n  some-job:\n    name: Custom K3d version\n    runs-on: ubuntu-22.04\n    steps:\n      - uses: nolar/setup-k3d-k3s@v1\n        with:\n          k3d-tag: v4.4.8\n      - run: k3d --version\n```\n\nCustom args can be passed to K3d (and through it, to K3s \u0026 K8s):\n\n```yaml\njobs:\n  some-job:\n    name: Custom args\n    runs-on: ubuntu-22.04\n    steps:\n      - uses: nolar/setup-k3d-k3s@v1\n        with:\n          k3d-args: --servers 2 --no-lb\n      - run: kubectl get nodes  # there must be two of them\n```\n\nFor real-life examples, see:\n\n* https://github.com/nolar/kopf/actions (all \"K3s…\" jobs).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnolar%2Fsetup-k3d-k3s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnolar%2Fsetup-k3d-k3s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnolar%2Fsetup-k3d-k3s/lists"}