Creates a Kubernetes cluster using K3s (1.24+) with Calico (3.27.0) for NetworkPolicy enforcement, and installs Helm 3 (3.5+).
k3s-version
ork3s-channel
: Specify a K3s version or release channel. Versions 1.24 and later are supported. Defaults to the stable channel.helm-version
: Specify a Helm version. Versions 3.1 and later are supported. Defaults to the latest version.metrics-enabled
: Enable or disable K3S metrics-server,true
(default) orfalse
.traefik-enabled
: Enable or disable K3S Traefik ingress,true
(default) orfalse
.docker-enabled
: Enable K3s to use the Docker daemon,true
orfalse
(default).extra-setup-args
: Extra arguments passed unquoted to the K3s setup script, use this if you require advanced customisation.
kubeconfig
: The absolute path to the kubeconfig file ($HOME/.kube/config
). TheKUBECONFIG
environment variable is also set by this action but may be removed in a future breaking release.k3s-version
: Installed k3s version, such as v1.29.0+k3s1k8s-version
: Installed k8s version, such as v1.29.0calico-version
: Installed calico version, such as v3.27.0helm-version
: Installed helm version, such as v3.13.0
name: Example workflow
on:
pull_request:
push:
workflow_dispatch:
jobs:
k8s-test:
runs-on: ubuntu-22.04
steps:
# GitHub Action reference: https://github.com/jupyterhub/action-k3s-helm
- name: Start a local k8s cluster
uses: jupyterhub/action-k3s-helm@v4
with:
# See available:
# - k3s release channels at https://github.com/k3s-io/k3s/blob/HEAD/channel.yaml
# - k3s versions at https://github.com/k3s-io/k3s/tags
# - helm versions at https://github.com/helm/helm/tags
k3s-channel: latest
# k3s-version: v1.29.0+k3s1
# helm-version: v3.13.0
- name: Verify function of k8s, kubectl, and helm
run: |
echo "kubeconfig: $KUBECONFIG"
kubectl version
kubectl get pods --all-namespaces
helm version
helm list
This is based on https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/08c13609c1d0c6cb07d45d49d0a876100cf941eb/ci/common by @consideratio.
This action aims to to provide an easy to use Kubernetes cluster with the following features:
- K3s
- Helm 3+
- Calico network provider that supports network policies
A small number of features are configurable.
All K3s defaults are kept except where they conflict with the deployment of Calico.
Due to the difficulty in comprehensively testing this action the aim is to minimise the number of arguments.
If you have an advanced use case hopefully extra-setup-args
will be sufficient.