k8t
Pronounced katie [ˈkeɪti]
Simple cluster and environment specific aware templating for kubernetes manifests.
Table of Contents generated with DocToc
installation
run this
$ pip install --user --upgrade k8t
note: k8t is not Python 2 compatible
usage
scaffolding
Create a new project folder with a cluster directory and an empty defaults file
$ k8t new project foobar
Create a new cluster
$ k8t new cluster A
Create a new environment
$ k8t new environment staging -c A
$ k8t new environment production
Generate a new deployment template for cluster A (currently only deployment and service are supported)
$ k8t new template deployment -c A
Specify prefixes for secrets
$ k8t edit config --cluster A --environment staging
secrets:
prefix: "staging/application"```
Values can be easily added/modified in the same way
$ k8t edit values --cluster Ano creds to it anyway or dont know where to get
A typical setup should look something like this
.deploy/
├── clusters
│ ├── A
│ │ ├── config.yaml
│ │ ├── environments
│ │ │ ├── production
│ │ │ │ ├── config.yaml
│ │ │ │ ├── files
│ │ │ │ ├── templates
│ │ │ │ └── values.yaml
│ │ │ └── staging
│ │ │ ├── config.yaml
│ │ │ ├── files
│ │ │ ├── templates
│ │ │ └── values.yaml
│ │ ├── files
│ │ ├── templates
│ │ └── values.yaml
│ └── local
│ ├── environments
│ ├── files
│ ├── secret.yaml.j2
│ ├── templates
│ │ ├── database.yaml.j2
│ │ └── secret.yaml.j2
│ └── values.yaml
├── config.yaml
├── files
├── templates
│ ├── deployment.yaml.j2
│ └── secret.yaml.j2
└── values.yaml
validate files
While validation is done before generating, templates can be validated for environment files easily.
$ k8t validate
To validate for clusters/environments the usual options can be used
$ k8t validate -c A -e production
generate files
The --cluster flag will load variables from a directory. By default the file default.yaml in that directory will be loaded, however an environment can be specified with --environment.
$ k8t gen -c A -e staging
Additionally k8t will attempt to load a file defaults.yaml in the root directory. This way a set of default variables can be specified and selectively overriden via cluster and environment.
Additional values can be given via flag --value-file in the form of a file or --value KEY VALUE, both can be supplied multiple times.
Variables will be merged via deep merging. Default merge strategy is left-to-right. For the merge order see the output of
$ k8t --help
Overriding templates
Templates can be overriden on a cluster/environment level.
If a file application.yaml exists in the root templates folder, simply add a file with the same name to the
cluster/environment template folder.
Managing secrets
SSM
Setup secrets on SSM
$ k8t edit config
secrets:
provider: ssm
prefix: "foobar"
TODO
- testing needs to be expanded
- add more templates for manifest scaffolding
- the ability to add additional template directories via the CLI
- validation functions for template values (e.g. memory/cpu values)
Release files for k8t 0.1.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| k8t-0.1.11.tar.gz | 21.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| k8t-0.1.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.3 kB
Release files / k8t-0.1.11.tar.gz
| Download URL | k8t-0.1.11.tar.gz |
|---|---|
| Size | 21.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d838ec350d793b8b450fd73512d6d8359fd74d151166992d628cd8d7402910b
|
|
BLAKE2b-256 checksum How to use checksums |
126ab1056ff8d4c478e522a0dd5551e298611557835b6a386f1abe953fde5d4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1
|
Release files / k8t-0.1.11-py3-none-any.whl
| Download URL | k8t-0.1.11-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c63678e8c6f695ce275cfe543c4d0fe33d155f24f391437451bb1084dcc1e062
|
|
BLAKE2b-256 checksum How to use checksums |
15c9511a73c702f0509b445a370321db6d23ecf9388208725c2a9834a1ab9605
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1
|