Skip to content

Install Kubernetes on a workstation or inside a CI runner, using kind https://kind.sigs.k8s.io/

License

Notifications You must be signed in to change notification settings

k8s-school/kind-helper

Repository files navigation

K8s-school Logo, expertise et formation Kubernetes

DEPRECATED, merged with https://github.com/k8s-school/k8s-toolbox

kind-helper

Helper to install Kubernetes clusters, based on kind, on any Linux system. Allow to easily setup:

  • multi-nodes cluster
  • use of Calico CNI
  • use of an insecure private registry

Can be used for VMs launched by a CI/CD platform, including Github Action

CI Status

Support kind v0.10.0 and k8s v1.20

Run kind on a workstation, in two lines of code

# Sudo access is required here
VERSION="v1.0.1-rc1"
curl -sfL https://raw.githubusercontent.com/k8s-school/kind-helper/$VERSION/install.sh | bash

# Run a single node k8s cluster with kind
kind-helper create -s

# Run a 3 nodes k8s cluster with kind
kind-helper create

# Run a k8s cluster with Calico CNI
kind-helper create -c

# Delete the kind cluster
kind-helper delete

Run kind inside Github Actions

Check this tutorial: build a Kubernetes CI with Kind in order to learn how to run kind inside Travis-CI.

Pre-requisites

  • Create a Github repository for a given application, for example: https://github.com/<GITHUB_ACCOUNT>/<GITHUB_REPOSITORY>

Setup

Enable Github Action by creating file .github/workflow/itests.yaml, based on template below:

name: "Integration tests"
on:
  push:
  pull_request:
    branches:
      - main
  itests:
    name: Run integration tests on Kubernetes
    runs-on: ubuntu-22.04
    needs: build
    env:
      GHA_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Create k8s/kind cluster
        run: |
	  VERSION="v1.0.1"
          curl -sfL https://raw.githubusercontent.com/k8s-school/kind-helper/$VERSION/install.sh | bash
          kind-helper create -s

     - run: |
          kubectl get nodes
          # Add scripts which deploy and tests application on Kubernetes

Additional resource