/kubetailor

Kubernetes operator that enables self-service deployments in your cluster through a simple HTTP API

Primary LanguageRustApache License 2.0Apache-2.0

WARNING: This is a work in progress.

Deploying random containers in your infrastructure is not very smart without taking the proper precautions. Documentation is very poor, sorry. Feel free to open an issue if you get stuck or have feature proposals.

Description

Kubetailor is a Kubernetes operator that simplifies the deployment of applications with their own domain, SSL certs, volumes, environment variables (via configMaps), secrets, volumes and fileMounts. What makes this useful is the addition of a backend server that can receive simplified versions of a TailoredApp manifest through its API and will merge all missing details using pre-filled information (annotations, storage classes, load balancer endpoint, etc) from its configuration. Kinda like how Helm merges --set arguments with values from a values.yaml file and the default values from the original chart.

Idea being: You configure most of the TailoredApp beforehand and let your end-users provide few values that will spin a container for them.

Deploy TL;DR

If you don't care about DNS and SSL and just want to see stuff being deployed, follow the steps below:

## Set your KUBECONFIG env var accordingly
export KUBECONFIG=~/.kube/your-config
## Deploy the crd and cluster role
kubectl create -f deploy/crd.yaml -f deploy/clusterrole.yaml
## Start the operator
## (At this point you can start deploying TailoredApp manifests if you want)
cargo run --bin operator
## Start the backend server -If trying out the backend API-
CONFIG_PATH=config/server/conf.yaml cargo run --bin server

Use the API to deploy an NGINX container with a static index.html file basic.json

curl --request POST --url http://127.0.0.1:8080/ \
  --header 'Content-Type: application/json' --data "@examples/basic.json"

Or deploy a base NGINX container that syncs to a repo hosting your static site git.json

curl --request POST --url http://127.0.0.1:8080/ \
  --header 'Content-Type: application/json' --data "@examples/git.json"

You should be see a Deployment, ConfigMap and Ingress being created now.

Services

  • Operator - Listens for new TailoredApps and constructs and deploys native Kubernetes resources from there.
  • Server - Receives simplified TailoredApps via HTTP and merges them with hard-coded values from its config
  • Console - A simple reference console to build the JSON request to send to the server.

Kubernetes Dependencies

Optional

External dependencies

I should probably work on a helm chart for this. Manual install is the only way for now, sorry.