Home

Awesome

<a href="https://zerodha.tech"><img src="https://zerodha.tech/static/images/github-badge.svg" align="right" /></a>

kubekutr

<img src="logo.png" alt="drawing" width="400"/>

🍪✂️ Cookie cutter for Kubernetes resource manifests

(Pronounced as "cube cutter")

kubekutr lets you quickly scaffold a bespoke configuration for Kubernetes resource manifests with an opinionated GitOps directory structure. kubekutr is ideally meant to be used in combination with kustomize.

Overview image

Motivation

kustomize is a great tool when it comes to declarative application management for manifests. There still exists a lot of manual scaffolding to create a base which defines your application state. kubekutr aims to solve the issue of writing these manifests manually by providing a very simple Go template rendering engine.

Read the blog post for more information.

Non Goals

kubekutr doesn't aim to provide all 1000s of options of templating yaml files. More users mean every user will want to customise the yaml in some way or the other and this is where kustomize comes into picture. Users of kubekutr are encourage to use kustomize to create variants on top of bases to apply any kind of customisation. kubekutr's only goal is to create the base directory.

Installation

Using snap

Get it from the Snap Store

$ sudo snap install kubekutr

Grab the latest binary

$ cd "$(mktemp -d)"
$ curl -sL "https://github.com/mr-karan/kubekutr/releases/download/0.8.2/kubekutr_0.8.2_$(uname)_amd64.tar.gz" | tar xz
$ mv kubekutr /usr/local/bin
# kubekutr should be available now in your $PATH
$ kubekutr --version

Usage

NAME:
   kubekutr - Cookie cutter for Kubernetes resource manifests

USAGE:
   kubekutr [global options] command [command options] [arguments...]

VERSION:
   4175090 (2020-02-06 18:03:26 +0530)

AUTHOR:
   Karan Sharma @mrkaran

COMMANDS:
   scaffold, s  Scaffold a new project with gitops structure
   init, i      Initialize a new project. Initializes git repo and a sample config file.
   help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --verbose                 Enable verbose logging
   --config value, -c value  path to one or more config files
   --help, -h                show help
   --version, -v             print the version

Initialise a new project

kubekutr init

asciicast

kubekutr init --default

Either of these options create a config file kubekutr.yml in your current working directory. You can edit this file further to suit your needs and scaffold a project using this.

kubekutr init -o <filename.yml>

Override the default config filename.

Scaffold a new project

# create a new base

$ kubekutr --config kubekutr.yml scaffold -o myproject

# `myproject` is created with the GitOps structure
myproject
`-- base
    |-- app
    |   |-- app-deployment.yml
    |   |-- app-ingress.yml
    |   |-- app-service.yml
    |-- second-app
        |-- db-statefulset.yml

Generate kustomization.yml

If you'd like to generate a super simple, default kustomization.yml in base folder at the time of scaffolding, you can specify --kustomize or -k with scaffold:

kubekutr --config kubekutr.yml scaffold -o myproject -k
resources:
  - app/app-service.yml
  - app/app-deployment.yml
  - app/app-service.yml
  - app/app-ingress.yml
  - second-app/db-statefulset.yml

Configuration

You can see a sample configuration file here.

⭐️ Show your support

Give a ⭐️ if this project helped you!

Contributing

This is still an alpha release. For a full list of things to improve, see unchecked items in TODO. Contributions welcome!