Skip to content

A simple project for bootstrapping kubernetes cluster for short experiments

License

Notifications You must be signed in to change notification settings

shini4i/disposable-k8s-cluster

Repository files navigation

disposable-k8s-cluster

This repository contains a set of scripts to create a disposable kubernetes cluster on one of supported cloud providers.

Showcase

General information

This project is intended to be used as a playground for testing and learning purposes. It is not intended to be used in production.

It was created in the way that should support extending it with new cloud providers and new applications.

Currently supported bootstrap options:

  • DigitalOcean
  • kind - not a cloud provider, but a tool to create a kubernetes cluster on a local machine

Additionally, to simplify access to the cluster, we are deploying external-dns and cert-manager to the cluster.

Those two controllers will be used to automatically create DNS records and TLS certificates for the ingress resources in the cluster.

Default applications

The following applications (controllers) are deployed to the cluster by default:

  • ArgoCD - a declarative, GitOps continuous delivery tool for Kubernetes
  • cert-manager - used to automatically create TLS certificates for the ingress resources
  • external-dns - used to automatically create DNS records for the ingress resources
  • traefik - used as an ingress controller (can be replaced by ingress-nginx)

Optional applications

The following applications can be deployed by enabling them in the deploy/terraform.tfvars:

Prerequisites

Mandatory

  • OpenTofu - used to create the cluster and deploy default applications
  • tfswitch - used to ensure that the correct version of tofu is used
  • GNU make - used to orchestrate the deployment
  • kubectl - used to interact with the cluster

Optional

  • direnv - used to automatically load environment variables from .env or .envrc files

Configuration

To start using the project, copy the .env.example file to .env and adjust in the required values.

cp .env.example .env

This mostly includes sensitive configuration.

The remaining configuration can be found in the deploy/terraform.tfvars file.

Usage

To set up a temporary kubernetes cluster, including infrastructure and common services run:

make bootstrap

To destroy ephemeral kubernetes cluster run:

make destroy

To stop kind cluster run:

make stop

To start kind cluster run:

make start

Contributing

Contributions are welcome! Feel free to submit a pull request. For major changes, please open an issue first to discuss.