This repository is meant to be a way to bootstrap your Kapitan setup to get you up and running.
It is meant to help you make use of best practices and libraries that can make Kapitan the ultimate tool for all your configuration needs.
$ git clone [email protected]:kapicorp/kapitan-reference.git kapitan-templates
$ cd kapitan-templates
$ ./kapitan compile
Compiled postgres-proxy (1.51s)
Compiled tesoro (1.70s)
Compiled echo-server (1.64s)
Compiled mysql (1.67s)
Compiled gke-pvm-killer (1.17s)
Compiled prod-sockshop (4.74s)
Compiled dev-sockshop (4.74s)
Compiled tutorial (1.68s)
Compiled global (0.76s)
Compiled examples (2.60s)
Compiled pritunl (2.03s)
Compiled sock-shop (4.36s)
Manifest Generator Documentation
This repo comes already with some helper tools. We will expand it as the time goes.
For now, you can see that the ./kapitan
file is a wrapper script that allows you to run kapitan without installing any binary (it does depends on docker!)
Note: For speed, if kapitan is already installed, it will prefer the non-docker version.
Script | Description |
---|---|
./kapitan | Wrapper script to invoke kapitan |
generate_sa_secrets.sh | Templated script to automatically inject service accounts into refs |
import_kubernetes_clusters | Helper scripts that looks for GKE cluster and automatically imports them into the inventory |
This repo already packs some important libraries that you will want to have when working with kapitan.
Name | Description | Inventory file |
---|---|---|
kube-libsonnet | bitnami-labs kube library | kube.yml |
kubernetes-generator | Synthace manifests generator | generators/kubernetes.yml |
ingresses-generator | Synthace ingresses generator | generators/ingresses.yml |
utils | helpful utilites | |
kap | Kapitan boilerplate in one file |
Kapitan allows you to manage external dependencies like the above libraries. For instance, in the spinnaker.yml file, the "dependencies" directive tells Kapitan where to find the library.
To update them, run:
./kapitan compile --fetch
Dependency lib/kube.libjsonnet : already exists. Ignoring
./kapitan compiledd
Compiled tesoro (1.70s)
Compiled echo-server (1.64s)
Compiled mysql (1.67s)
Compiled gke-pvm-killer (1.17s)
Compiled prod-sockshop (4.74s)
Compiled dev-sockshop (4.74s)
Compiled tutorial (1.68s)
Compiled global (0.76s)
Compiled examples (2.60s)
Compiled pritunl (2.03s)
Compiled sock-shop (4.36s)
As explained in the blog post Keep your ship together with Kapitan. generators are a powerful idea to simplify the management your setup.
We will release initially generators for kubernetes manifests, terraform and spinnaker pipelines.
For now, only the manifests
and ingresses
generators are available
The manifests
generator allows you to quickly generate Kubernetes manifests from a much simpler yaml configuration.
The aim for this approach is to allow you to cover the vast majority of the needs you will have for your components. More complex scenarios can also be achieved by expanding the library, or implementing your own template.
To help you get started, please look at the following examples:
source | description | output |
---|---|---|
mysql | Example MySQL statefulset | manifests |
echo-server | Example using echo-server | manifests |
gke-pvm-killer | Example using estafette-gke-preemptible-killer | manifests |
postgres-proxy | Example using cloud-sql-proxy to connect to a Cloud SQL Postgres instance | manifests |
logstash | Example of Logstash configuration | manifests |
tesoro | Example of tesoro configuration | manifests |
pritunl | Example of pritunl configuration | manifests |
Please find the generated manifests in the compiled folder
The ingresses
generator adds to the manifests
generator the ability to easily define ingress resources.
To help you get started, please look at the following examples:
source | description | output |
---|---|---|
echo-server | Defining ingress paths using echo-server | manifests |
We have used this generator extensively, and we know it covers the majority of the use cases. If you want a specific example, please let us know (or submit your PR)
By adding more example we will be able to stress test the library to make sure we really satisfy all the most common use cases.