Skip to content

scout-ch/tractor-k8s-tenants

Repository files navigation

tractor-k8s-tenants

OpenTofu config to manage tenants in the shared tractor Kubernetes cluster.

Usage

Important

Prerequisites:

To add a new tenant, add it to users.tf, tenants.tf and outputs.tf accordingly.

Then run:

cd tofu
tofu init
tofu apply
tofu output -raw kubeconfig_<username> > kubeconfig.yaml

You can then use the generated kubeconfig.yaml to access the tenant's namespace in the cluster.

Revoking a lost kubeconfig / Creating a new one

If you lose your kubeconfig or want to create a new one, you can do so by tainting the random_string resource in the respective tenant file and re-applying the configuration. This will generate a new kubeconfig for you and make the old one have no access.

cd tofu
tofu taint "module.u_<username>.random_string.suffix"
tofu apply
tofu output -raw kubeconfig_<username> > kubeconfig.yaml

Tenants

When seting up a tenant, a git repo will be created that gets synced into the cluster automatically using FluxCD. FluxCD automatically applies your configs from Github and continuously makes sure it is applied. You find a very good introduction in their documentation.

With FluxCD you can either deploy raw kubernetes configs but you can also configure Flux Resources like.

You can also have a look at the following example repositories:

About

Terraform config to manage tenants in the shared tractor Kubernetes cluster.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages