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 git@github.com:kapicorp/kapitan-reference.git kapitan-templates
$ cd kapitan-templates
$ ./kapitan compile
Compiled examples/gke-pvm-killer (0.36s)
Compiled examples/postgres-proxy (0.37s)
Compiled examples/echo-server (0.39s)
Compiled examples/mysql (0.40s)
Compiled examples/tutorial (0.31s)
Compiled examples/examples (0.43s)
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_cluster.sh | 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 |
sponnet | Jsonnet library specifically for Spinnaker | spinnaker.yml |
manifests-generator | Synthace manifests generator | generators/manifests.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
Dependency lib/spinnaker-pipeline.libjsonnet : already exists. Ignoring
Dependency lib/spinnaker-application.libjsonnet : already exists. Ignoring
Compiled examples/gke-pvm-killer (0.36s)
Compiled examples/postgres-proxy (0.37s)
Compiled examples/echo-server (0.39s)
Compiled examples/mysql (0.40s)
Compiled examples/tutorial (0.31s)
Compiled examples/examples (0.43s)
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 |
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.