Skip to content

ochestra-tech/kube-runner

Repository files navigation

KubeRunner

KubeRunner is a Go-based tool for automating Kubernetes cluster installation and setup on Linux systems. It provides a simple, interactive way to bootstrap both control plane and worker nodes.

Features

  • Automatic detection of Linux distribution
  • Support for Debian and RedHat based distributions
  • Containerd runtime installation and configuration
  • Kubernetes control plane initialization
  • Calico network plugin installation
  • Optional Kubernetes Dashboard installation
  • Worker node join command generation
  • High-availability cluster setup
  • Node joining (both worker and control plane nodes)
  • Node labeling and tainting
  • Cluster upgrade capabilities
  • Cluster status checking
  • robust configuration options

Control Plane Setup

When setting up a control plane node, KubeRunner will:

  • Install and configure containerd
  • Install Kubernetes components (kubeadm, kubelet, kubectl)
  • Initialize the Kubernetes control plane
  • Install the Calico network plugin
  • Generate a join command for worker nodes
  • Optionally install the Kubernetes Dashboard

Worker Node Setup

When setting up a worker node, KubeRunner will:

  • Install and configure containerd
  • Install Kubernetes components
  • Prompt for the join command from the control plane
  • Join the node to the cluster

High Availability Setup

KubeRunner supports high availability setups with multiple control plane nodes. When configuring a high availability cluster:

  • Set up a load balancer in front of the API servers
  • Configure the first control plane node with the load balancer endpoint
  • Join additional control plane nodes using certificate key

Installation

Build from source

git clone https://github.com/ochestra-tech/KubeRunner.git
cd KubeRunner
make build
sudo make install

Building and Installing KubeRunner with Docker

This is more practical approach that uses Docker only as a build environment, producing a standalone binary that can be run directly on the host system. This addresses security concerns while leveraging containerization for consistent builds.

Using Docker as a Build Environment

KubeRunner provides a containerized build environment that produces standalone binaries for direct use on the host system. This approach avoids running privileged containers while still leveraging Docker for consistent builds.

Key Benefits of This Approach

  • Secure: No need for privileged containers at runtime

  • Portable: Builds binaries for multiple architectures

  • Consistent: Same build environment regardless of host OS

  • Simple: Easy installation process using generated script

  • Flexible: Can run directly on the host with full access to system resources

  • CI/CD friendly: Easy to integrate into build pipelines

a. Build the binaries:

./scripts/docker-build.sh

b. Install KubeRunner on the host system:

./scripts/install-host.sh

c. Run KubeRunner

KubeRunner

Manual Installation

If you prefer to build and install KubeRunner manually:

  1. Build the binary:
go build -o KubeRunner cmd/KubeRunner/main.go
  1. Install it
sudo cp KubeRunner /usr/local/bin/
sudo mkdir -p /usr/local/lib/KubeRunner/assets
sudo cp -r assets/* /usr/local/lib/KubeRunner/assets/
sudo chmod +x /usr/local/bin/KubeRunner

Usage Demo

# Build the binaries
./build.sh

# Install KubeRunner on the host system
./install-host.sh

# Run KubeRunner
KubeRunner

K8s Cluster Setup with Batch Script

scripts/k8s-cluster-setup is the batch script version of this go cluster creation tool

Usage Instructions

  1. Save the script to a file (e.g., setup-kubernetes.sh)
  2. Make it executable: chmod +x setup-kubernetes.sh
  3. Run it as root: sudo ./setup-kubernetes.sh
  4. First run the script on the machine you want to be the master node
  5. When prompted, indicate it's a master node
  6. Save the join command that is generated
  7. Run the script on each worker node
  8. When prompted, indicate it's not a master node
  9. Run the join command you saved earlier on each worker node

After completing these steps, you'll have a functional Kubernetes cluster with networking configured and ready to deploy applications.


kubeopera-deploy (Go deployment pipeline)

A separate binary kubeopera-deploy implements the full kubeopera infrastructure deployment pipeline in Go, replacing the bash script deploy-kubeopera.sh with an 11-step orchestration.

Build

go build -o kubeopera-deploy ./cmd/kubeopera-deploy/

Usage

# Full pipeline (pass path to kubeopera infrastructure/scripts)
./kubeopera-deploy --environment staging --script-dir /path/to/kubeopera/infrastructure/scripts

# Skip confirmation (e.g. CI)
./kubeopera-deploy -e production -s /path/to/scripts -y

# Run only steps 3–5
./kubeopera-deploy -e staging -s /path/to/scripts --start-step 3 --stop-step 5

Options

Option Description
-e, --environment development, staging, or production (default: production)
-s, --script-dir Path to kubeopera infrastructure/scripts directory
-y, --skip-confirmation Skip confirmation prompts
--start-step Start at step N (1–11)
--stop-step Stop at step N (1–11)

Pipeline steps

  1. Prerequisites – Check terraform, kubectl, helm, aws, jq, ssh and AWS credentials
  2. Terraform backend – Create S3 bucket and DynamoDB table (AWS SDK)
  3. Infrastructure – Terraform init/plan/apply; copy SSH key and outputs to bastion
  4. Configure nodes – Run configure-nodes.sh on each node via bastion
  5. Install Kubernetes – Run install-kubernetes.sh on bastion
  6. Networking – Install Calico CNI
  7. Monitoring – Install Prometheus and Grafana
  8. Kubeconfig – Copy kubeconfig from bastion to local ~/.kube/config-{env}
  9. Verifykubectl get nodes/pods, cluster-info
  10. Backups – Schedule etcd backup cron on control plane nodes
  11. Add-ons – CCM/CSI/Metrics/Ingress via install-kubernetes.sh RUN_MODE=addons

Bootstrap scripts (e.g. configure-nodes.sh, install-kubernetes.sh) remain as-is; the Go binary copies and runs them over SSH. Step 2 (Terraform backend) is implemented entirely in Go using the AWS SDK.

About

Create and initiate K8s clusters with ease, speed and precision

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published