Skip to content

Repository files navigation

Kubernetes development environment

This repository contains terraform modules used to setup a Kubernetes development environment in Hetzner Cloud.

Warning

This project is not an official Hetzner Cloud Integration and is intended to be used internally. There is no backwards-compatibility promise.

Modules

The environment is split in two modules that must be used in two separate states:

Module Manages
modules/infra Hetzner Cloud resources (SSH key, network, servers) and the k3s cluster running on them.
modules/k8s Resources inside the cluster (hcloud Secret, Cilium, hccm, csi-driver, Docker registry).

The kubernetes and helm providers of the k8s module are configured from an input variable, and never from an attribute of a resource in the same state. Terraform can therefore always plan and destroy the in-cluster resources, even while the cluster is being replaced or is already gone. Recreating the cluster (e.g. when changing the k3s version) simply recreates the in-cluster resources on the next apply, instead of stranding them in a state that points at a cluster that no longer exists.

The infra state must be applied before the k8s state, and destroyed after it. See example/ for the wiring between both states, done with a terraform_remote_state data source.

Usage

To setup a development environment, make sure you installed the following tools:

  1. Configure a HCLOUD_TOKEN in your shell session.

Warning

The development environment runs on Hetzner Cloud servers which will induce costs.

  1. Deploy the development cluster:
make -C example up
  1. Load the generated configuration to access the development cluster:
source example/files/env.sh
  1. Check that the development cluster is healthy:
kubectl get nodes -o wide

⚠️ Do not forget to clean up the development cluster once are finished:

make -C example down

About

Kubernetes development environment for our Integrations.

Topics

Resources

Contributing

Stars

11 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages