k8s-toolbox

command module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

README

K8s-school Logo, expertise et formation Kubernetes


| | ( _ ) ___ | | ___ ___ | | |__ _____ __ | |/ / _ / || / _ \ / _ | | ' \ / _ \ / / | < () _ _| || () | () | | |) | () > < |_|__/|/ __/ _/||./ _/_/_\

k8s-toolbox

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
K8S_TOOLBOX_VERSION="v1.0.0-rc1"
curl -sfL https://raw.githubusercontent.com/k8s-school/k8s-toolbox/$K8S_TOOLBOX_VERSION/install.sh | bash

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

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

# Run a k8s cluster with Calico CNI
k8s-toolbox create -c

# Delete the kind cluster
k8s-toolbox delete

Enabling k8s-toolbox auto-completion

Example for bash on Linux

# install bash-completion
sudo apt-get install bash-completion

# Add the completion script to your .bashrc file
echo 'source <(k8s-toolbox completion bash)' >>~/.bashrc

# Apply changes
source ~/.bashrc

If you have an alias for k8s-toolbox, you can extend your shell's completion to work with this alias:

echo 'alias k8x=k8s-toolbox' >>~/.bashrc

echo 'complete -o default -F __start_k8s-toolbox k8x' >>~/.bashrc

Run kind inside Github Actions

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: "Install k8s cluster"
on:
  push:
  pull_request:
    branches:
      - master

jobs:
  k8s-install:
    name: Install k8s
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: actions/setup-go@v3
        with:
          go-version: '^1.20.3'
      - name: Create k8s/kind cluster
        run: |
          go install github.com/k8s-school/k8s-toolbox@main
          k8s-toolbox create -s
          k8s-toolbox install kubectl
      - name: Install and test application
        run: |
          kubectl create deployment my-nginx --image=nginx
          kubectl expose deployment my-nginx --port=80

Documentation

Overview

Copyright © 2023 Fabrice Jammes fabrice.jammes@gmail.com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Directories

Path Synopsis
ktbx module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL