• This repository has been archived on 04/Aug/2023
  • Stars
    star
    158
  • Rank 230,282 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 5 years ago
  • Updated almost 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

awesome-investing

💸💸 Curated list of investment & finance related resources
1,800
star
2

doggo

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

swiggy-analytics

Analyse your swiggy orders 🍔
Python
265
star
4

homelab

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

barreldb

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

calert

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

monkeybeat

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

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
52
star
9

webkin

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

nomad-monitoring

Collection of jobspecs and Grafana dashboards for end to end monitoring of Nomad clusters
HCL
47
star
11

nomad-events-sink

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

flexit

Responsive grid based on CSS Flexbox
HTML
45
star
13

nomctx

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

notes

Collection of my byte sized notes on programming and other random topics.
Makefile
35
star
15

nomad-external-dns

Set external DNS records for Nomad services
Go
33
star
16

cloak

Securely share sensitive text with others
Go
31
star
17

store-exporter

Utility to extract metrics from arbitary data stores in Prometheus format
Go
30
star
18

clickhouse-keeper-example

Setup ClickHouse cluster with replication using `clickhouse-keeper`
Makefile
29
star
19

fate

Browse FontAawesome icons from your shell
Python
29
star
20

website

Personal site, made using Zola
HTML
29
star
21

coredns-nomad

Go
27
star
22

terraform-provider-kite

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

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
24

balance

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

haraka-plugin-outbound-logger

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

kiteHistory

🤑 Kite History API wrapper
Python
14
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
14
star
28

vscode-kite

Visual Studio Code extension for KiteConnect API
JavaScript
13
star
29

kite-yoda

Ignorance is bliss.
JavaScript
12
star
30

nomadev

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

clx

Generate CLI commands using AI for common ops
Go
12
star
32

simplehealth

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

k8s-deployment-book

⭐ Kubernetes - Production Deployments for Developers (Book) ⭐
HTML
11
star
34

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
35

ebs-snapshot-exporter

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

kong-service-exporter

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

calwarrior

Calendar web view for Takwarrior
Vue
7
star
38

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
39

NoiseInspector

📢 Arduino + Python + ESP8266 Wifi = Noise Level Monitor
Arduino
6
star
40

eks-gitops

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

alertmatter

Alertmanager - Mattermost Webhook Receiver
Go
5
star
42

caddy-plugins-docker

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

haraka-docker

Docker image for Haraka SMTP server
Dockerfile
5
star
44

listmonk-infra

Source code for deploying listmonk on Kubernetes
Makefile
4
star
45

mfp-calorie-extract

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

cgroup-stats

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

pinkFloyd-Lyrics

Analyzing Pink Floyd lyrics
HTML
4
star
48

SNUMessApp

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

notion-weightbot

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

k8s-pruner

Cleanup unused configmaps in a Kubernetes namespace
Shell
2
star
51

fritter

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

talks

HTML
2
star
53

NetNeutralityBadge

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

vscode-nomfmt

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

Algorithm-Implementations--Python

Some Implementations of Algorithms in Python
Python
1
star
56

kong-ansible

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

aws-dc-exporter

Prometheus metrics exporter for AWS Direct Connect
Go
1
star
58

koanf-test

Go
1
star
59

rubberduck

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

Python-Scripts

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

telegramBot-YtDownload

Telegram Bot which downloads Youtube videos
Python
1
star
62

newsletter

HTML
1
star
63

weather-Twitter-Bot

Made a Weather Twitter Bot using Python
Python
1
star
64

HackerRank-Problems

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

khoj

CSE SNU Project Final Year
Python
1
star