• This repository has been archived on 04/Aug/2023
  • Stars
    star
    159
  • Rank 235,916 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cookie cutter templating tool for scaffolding K8s manifests

kubekutr

drawing

🍪✂️ 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

  • Using Prompt

kubekutr init

asciicast

  • Using default config

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.

  • Define output file

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.

  • workloads
    • name: Name of the workload. A workload represents the complete set of resources required to deploy an application

    • deployments

      • name: Name of the deployment
      • replicas: Represents the number of replicas for a Pod
      • labels:
        • name: Represent the key value pair as a string. For eg: "app.kubernetes.io/tier: cache"
      • containers: List of containers in a Pod
        • name: Unique name for a container
        • image: Docker image name
        • ports:
          • name: Unique identifier for the port.
          • port: Port address/name for port exposed on container.
          • createService: (False/True): Automatically create a Service manifest based on the port settings of container.
        • command: Entrypoint array
        • args: Arguments to the entrypoint
        • envVars: List of environment variables to set in the container
          • name: Name of environment variable
          • value: Value of environment variable
        • volumeMounts: Pod volumes to mount into the container's filesystem
          • name: Name of Volume
          • mountPath: Path within the container at which the volume should be mounted
          • subPath: Path within the volume from which the container's volume should be mounted.
      • volumes: List of volumes defined for a deployment - name: Name of Volume
    • statefulsets

      • name: Name of the statefulset
      • serviceName: serviceName is the name of the service that governs this StatefulSet
      • labels: (reference above)
      • containers: (reference above)
      • volumes:(reference above)
    • services

      • name: Name of service
      • type: Type of service. Can be one of ClusterIP, NodePort, LoadBalancer
      • ports:
        • name: Unique identifier for the port.
        • port: Port address/name for port exposed on container.
        • targetPort: Number or name of the port to access on the pods targeted by the service
        • protocol: Defaults to TCP. (Can be either TCP/UDP)
      • labels: (reference above)
      • selectors:
        • name: Route service traffic to pods with label keys and values matching this selector
    • ingresses

      • name: Name of ingress
      • ingressPaths
        • path: Path which map requests to backends
        • service: Specifies the name of the referenced service
        • port: Specifies the port of the referenced service
      • labels: (reference above)
      • annotations:
        • name: Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata

⭐️ 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!

More Repositories

1

doggo

🐶 Command-line DNS Client for Humans. Written in Golang
Go
3,034
star
2

awesome-investing

💸💸 Curated list of investment & finance related resources
1,902
star
3

swiggy-analytics

Analyse your swiggy orders 🍔
Python
271
star
4

homelab

Infra-as-code for my personal home server setup
HTML
254
star
5

barreldb

A disk based KV store (based on Bitcask implementation)
Go
166
star
6

calert

🔔 Send alert notifications to Google Chat via Prometheus Alertmanager
Go
153
star
7

gullak

A no-frills expense tracker app enabling quick logging of expenses in natural language, using LLMs for parsing and categorization.
Vue
75
star
8

monkeybeat

Generate a random stock portfolio and find out if it beats the markets!
Go
64
star
9

nomad-monitoring

Collection of jobspecs and Grafana dashboards for end to end monitoring of Nomad clusters
HCL
53
star
10

nomad-vector-logger

A daemon which continuously watches jobs running in a Nomad cluster and templates out a Vector configuration file which can be used to collect application logs enriched with Nomad metadata.
Go
53
star
11

webkin

💻 CLI tool to send webpages to kindle. 📔
Python
50
star
12

nomad-events-sink

An events collection agent which processes Nomad Events and dumps to external sink providers like HTTP
Go
49
star
13

nomctx

Faster way to switch between clusters and namespaces in nomad
Go
47
star
14

flexit

Responsive grid based on CSS Flexbox
HTML
45
star
15

notes

Collection of my byte sized notes on programming and other random topics.
Makefile
37
star
16

nomad-external-dns

Set external DNS records for Nomad services
Go
36
star
17

cloak

Securely share sensitive text with others
Go
33
star
18

store-exporter

Utility to extract metrics from arbitary data stores in Prometheus format
Go
32
star
19

clickhouse-keeper-example

Setup ClickHouse cluster with replication using `clickhouse-keeper`
Makefile
30
star
20

website

Personal site, made using Zola
HTML
30
star
21

fate

Browse FontAawesome icons from your shell
Python
29
star
22

coredns-nomad

Go
29
star
23

terraform-provider-kite

Terraform provider for managing long term portfolio with Zerodha Kite
Go
24
star
24

Insta-notFollow

A Flask web app to find out people whom you follow on Instagram but they don't follow you back 😈
HTML
22
star
25

toru

Toru is a Go module proxy with caching and rewrite capabilities
Go
22
star
26

balance

Minimal Golang library for implemeting weighted round robin load balancing.
Go
21
star
27

1brc-go

1️⃣🐝🏎️ The One Billion Row Challenge -- A fun exploration of how quickly 1B rows from a text file can be aggregated with Golang
Go
16
star
28

clx

Generate CLI commands using AI for common ops
Go
16
star
29

haraka-plugin-outbound-logger

Haraka SMTP plugin for logging outbound traffic. Useful for storing audit information of delivered/bounced emails.
JavaScript
15
star
30

nomcfg

HTML
15
star
31

kiteHistory

🤑 Kite History API wrapper
Python
14
star
32

vscode-kite

Visual Studio Code extension for KiteConnect API
JavaScript
13
star
33

kite-yoda

Ignorance is bliss.
JavaScript
12
star
34

k8s-deployment-book

⭐ Kubernetes - Production Deployments for Developers (Book) ⭐
HTML
12
star
35

nomadev

Docker based development workflow with Nomad and Consul
Dockerfile
12
star
36

simplehealth

Tiny lib for exposing health-check endpoints as Prometheus/JSON format
Go
11
star
37

localhashi

Vagrant based setup for local Nomad/Consul clusters. Helpful for experimenting with Nomad job specs in an environment similar to production.
Jinja
10
star
38

junbi

Shell
9
star
39

ebs-snapshot-exporter

Export AWS EBS Snapshots data as Prometheus metrics
Go
8
star
40

kong-service-exporter

Utility to create a export a service registry Markdown file from Kong's config
Python
8
star
41

alertmatter

Alertmanager - Mattermost Webhook Receiver
Go
7
star
42

calwarrior

Calendar web view for Takwarrior
Vue
7
star
43

NoiseInspector

📢 Arduino + Python + ESP8266 Wifi = Noise Level Monitor
Arduino
7
star
44

ansible-server-logs-monitoring

Ansible playbook to install ELK stack for log analysis and Prometheus/AlertManager/Node Exporter/Grafana for Server monitoring. Or as they say, One 💍 to rule them all!
7
star
45

eks-gitops

Set of utilities to do deployments in an EKS cluster
Dockerfile
6
star
46

caddy-plugins-docker

Docker image for Caddy with custom plugins baked into the image.
Dockerfile
5
star
47

haraka-docker

Docker image for Haraka SMTP server
Dockerfile
5
star
48

listmonk-infra

Source code for deploying listmonk on Kubernetes
Makefile
4
star
49

mfp-calorie-extract

Copy macronutrients information from MFP and paste them in Google Sheets for calorie tracking
JavaScript
4
star
50

cgroup-stats

Tiny Go library designed for retrieving CPU and Memory quota information from Linux control groups (cgroups).
Go
4
star
51

pinkFloyd-Lyrics

Analyzing Pink Floyd lyrics
HTML
4
star
52

SNUMessApp

Android App for SNU Weekly Mess Menu
Jupyter Notebook
3
star
53

notion-weightbot

A Telegram bot which tracks bodyweight and stores the records in a Notion Database and CSV
Go
3
star
54

fritter

Know if it's a good time to call your posh NRI fraands
Go
2
star
55

k8s-pruner

Cleanup unused configmaps in a Kubernetes namespace
Shell
2
star
56

talks

HTML
2
star
57

NetNeutralityBadge

Add SaveTheInternet Badge to your Facebook DP to show support for Net Neutrality
HTML
2
star
58

vscode-nomfmt

Visual Studio Code extension for on-the-fly formatting of Nomad job specs in HCL using `nomad fmt`.
TypeScript
1
star
59

Algorithm-Implementations--Python

Some Implementations of Algorithms in Python
Python
1
star
60

aws-dc-exporter

Prometheus metrics exporter for AWS Direct Connect
Go
1
star
61

kong-ansible

Ansible Playbook for setting up Kong node and using Cassandra as datastore
1
star
62

koanf-test

Go
1
star
63

rubberduck

Toolbox of useful utilities for debugging inside Containers
Go
1
star
64

Python-Scripts

Writing Python Scripts to do boring monotonous work the fun way :D
Python
1
star
65

telegramBot-YtDownload

Telegram Bot which downloads Youtube videos
Python
1
star
66

newsletter

HTML
1
star
67

weather-Twitter-Bot

Made a Weather Twitter Bot using Python
Python
1
star
68

HackerRank-Problems

My codes for some problems on HackerRank : https://www.hackerrank.com/domains/miscellaneous/python-tutorials
Python
1
star
69

khoj

CSE SNU Project Final Year
Python
1
star