Skip to content

k8kreator is a lightweight wrapper to setup up and manage Kubernetes clusters

License

Notifications You must be signed in to change notification settings

sepen/k8kreator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Lightweight wrapper to manage Kubernetes clusters

Last Commit Repo Size Code Size Proudly Written in Bash

Features

  • Ease of creating and maintaining local clusters with different engines (kind, k3d and minikube)
  • Addons for easily installed Kubernetes applications
  • Ability to test the latest versions of Kubernetes and installed Kubernetes applications
  • Cross-platform (Linux and macOS)
  • Automatic configuration of a load-balancer

Table of Contents

Installation

To install k8kreator paste that in a macOS Terminal or Linux shell prompt:

$ curl -fsSL https://raw.githubusercontent.com/sepen/k8kreator/main/k8kreator | bash -s self install
  • The one-liner command from above installs k8kreator to its default, $HOME/.k8kreator and will place some files under that prefix, so you'll need to set your PATH like this export PATH=$HOME/.k8kreator/bin:$PATH.
  • The installation explains what it will do, and you will see all that information. Consider adding this line to your ~/.bashrc or ~/.bash_profile or make sure to export this PATH before running k8kreator. The installation explains what it will do.
  • The one-liner installation method found on k8kreator uses Bash. Notably, zsh, fish, tcsh and csh will not work.

Usage

Create a new cluster

$ k8kreator cluster create

Install some addons

$ k8kreator addons install "metrics-server metallb ingress-nginx jenkins"

Run k8kreator help for more information

Environment Variables

Run k8kreator env to get a complete list of environment variables. Most notable are:

Variable Defaults Description
K8KREATOR_TARGET k8kreator.kind.local Active cluster target. Run 'k8kreator cluster list' to get all available targets
K8KREATOR_DEBUG 0 Indicate whether or not k8kreator is running in Debug mode
K8KREATOR_NOCOLOR 0 Disable colored output messages. Set K8KREATOR_NOCOLOR=1 to disable
K8KREATOR_BINDIR $HOME/.k8kreator/bin Path location for binary files
K8KREATOR_SRCDIR $HOME/.k8kreator/src Path location for source files

Targets

Targets are the reference units to create a cluster (name.engine.domain). By default k8kreator provides the following targets:

Name Kubernetes Tools
k8kreator.kind.local 1.29.2 kind=0.22.0 kubectl=1.30.0 helm=3.14.0
k8kreator.k3d.local 1.27.4 k3d=5.6.0 kubectl=1.28.1 helm=3.12.3
k8kreator.minikube.local 1.26.8 minikube=1.31.2 kubectl=1.26.8 helm=3.12.3

Local targets are located in ~/.k8kreator/src/targets

Engines

At the moment the supported engines are the following:

Name Description
kind A tool for running local Kubernetes clusters using Docker container “nodes”
k3d A lightweight wrapper to run k3s (Rancher Lab's minimal Kubernetes distribution) in docker
minikube A tool for running a local Kubernetes cluster, focusing on making it easy to learn and develop for Kubernetes

Addons

Addons are maintained extensions used for added functionality to clusters. At this moment the addons available are the following:

Name Description
metrics-server It collects resource metrics from Kubelets and exposes them in Kubernetes apiserver through Metrics API
metallb A load-balancer implementation for bare metal Kubernetes clusters, using standard routing protocols
ingress-nginx An Ingress controller for Kubernetes using Nginx as a reverse proxy and load-balancer
kubernetes-dashboard Web-based UI that allows administrators to perform basic operating tasks and review cluster events
kubewatch Kubernetes watcher that publishes notifications to Slack/hipchat/mattermost/flock channels
prometheus Systems monitoring and alerting toolkit with an active ecosystem. It is the only system directly supported by Kubernetes and the de facto standard across the cloud native ecosystem
promtail An agent which ships the contents of local logs to a private Grafana Loki instance or Grafana Cloud
loki Horizontally-scalable, highly-available, multi-tenant log aggregation system inspired by Prometheus
grafana Query, visualize, alert on, and explore your metrics, logs, and traces
jenkins Continuous integration/continuous delivery and deployment (CI/CD) automation software DevOps tool

Local addons are located in ~/.k8kreator/src/addons

Important Notes

The idea behind k8kreator is to be able to run clusters with different Kubernetes engines and have a homogeneous way to install and maintain cluster addons. It was primarily designed for testing Kubernetes itself, but may be used for local development or CI (you can use it in production but it's not what it's designed for, so do it at your own risk).

Troubleshooting

With Docker on Linux, you can send traffic directly to the load-balancer’s external IP if the IP space is within the docker IP space.

On macOS and Windows, docker does not expose the docker network to the host. Because of this limitation, containers (including nodes) are only reachable from the host via port-forwards, however other containers/pods can reach other things running in docker including load-balancers. You may want to check out the Ingress Guide as a cross-platform workaround. You can also expose pods and services using extra port mappings.

On macOS you can try docker-mac-net-connect to use a load-balancer's external IP.