container-tools / kind-action

Apache License 2.0
24 stars 10 forks source link

Kubernetes KinD Cluster Action

A GitHub Action for starting a Kubernetes cluster with a local registry and optional addons (Knative) using KinD.

This action provides an insecure registry on kind-registry:5000 by default: it can be used to publish and deploy container images into KinD.

Usage

Pre-requisites

Create a workflow YAML file in your .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Inputs

For more information on inputs, see the API Documentation

Example Workflow

Create a workflow (eg: .github/workflows/create-cluster.yml):

name: Create Cluster

on: pull_request

jobs:
  create-cluster:
    runs-on: ubuntu-latest
    steps:
      - name: Kubernetes KinD Cluster
        uses: container-tools/kind-action@v1

This uses @container-tools/kind-action GitHub Action to spin up a KinD Kubernetes cluster on every Pull Request.

A container registry will be created with address kind-registry:5000 on both the host and the cluster. The registry address is stored in the KIND_REGISTRY environment variable, also for the subsequent steps.

Configuring Addons

Create a workflow (eg: .github/workflows/create-cluster-with-addons.yml):

name: Create Cluster with Addons

on: pull_request

jobs:
  create-cluster-with-addons:
    runs-on: ubuntu-latest
    steps:
      - name: Kubernetes KinD Cluster
        uses: container-tools/kind-action@v1
        with:
          knative_serving: v1.0.0
          knative_kourier: v1.0.0
          knative_eventing: v1.0.0

This will install Knative Serving, Eventing and a Kourier Ingress on your Kind cluster. To make Knative run on Kind, resource request and limits are removed from the original Knative descriptors.

Credits

This action leverages the good work done by the Helm community on @helm/kind-action.