# README
kubo
A simple utility to help with kubernetes manifest management and deployment.
Installation
If you have go installed you can use:
go get github.com/tomwright/kubo/cmd/kubo
Alternatively you can download a compiled executable from the latest release:
Ensure you change the desired release executable from the following. It currently targets kubo_linux_amd64
.
curl -s https://api.github.com/repos/tomwright/kubo/releases/latest | grep browser_download_url | grep linux_amd64 | cut -d '"' -f 4 | wget -qi - && mv kubo_linux_amd64 kubo && chmod +x kubo
$ kubo
A small helper to manage kubernetes configurations.
Usage:
kubo [command]
Available Commands:
apply Apply kubernetes manifests for the given service and environment.
generate Generate kubernetes manifests for the given service, template and environment.
help Help about any command
update Update config files that are used during manifest generation.
Flags:
-b, --base string Full path to kubo base directory. (default ".")
-e, --environment string The environment to work with. (default "default")
-h, --help help for kubo
Use "kubo [command] --help" for more information about a command.
Structure
All kubo managed files are expected to be in the following structure.
- base
-- config
--- {SERVICE}
---- {NAMESPACE}
----- {TEMPLATE}.yaml
----- ...
-- templates
--- {TEMPLATE}
---- deployment.yaml
---- cluster-ip.yaml
---- ...
-- k8s
--- {SERVICE}
---- {NAMESPACE}
----- deployment.yaml
----- cluster-ip.yaml
----- ...
Example
There is a basic example within the example directory.
You can clone this repo, change some values and re-generate the example with:
kubo generate -b ./example -e production user
Templates
Contains the manifest file templates for a given service in a given environment.
Supports all functionality provided by Go's text/template package.
Basic replacements can be done using {{ .name }}
or {{ .image.version }}
for object access.
Config
Contains the values used when parsing the templates.
The name of the config file should match the name of the template you are generating.
You can update these files directly, or by using the dasel
command line tool:
dasel put string -f config/auth/development/service.yaml -s "image.version" v1.0.0
The above updates the service.yaml
template config within the development
environment, for the service auth
.
k8s
The k8s directory contains of the manifests generated by kubo.
You can generate these manifests with the following command.
kubo generate -e development auth
The above generates the manifests for the auth
service within the development
environment.
By default, it uses the service
template, but you can change this using -t <template name>
.
Base path
The base path within kubo is important.
By default, the working directory is used.
If however you want to use kubo from a different directory you can use -b <base path>
in any of the commands.
kubo generate -b ~/kubo/base -e development auth