Kubernetes Boilerplate Config Generator

For many first time Kubernetes users, creating valid YAMLs is prone to errors and results in an unpleasant experience. This tool was created with the intention to help early users of Kubernetes with boilerplate config YAMLs.

“A special mention for Sergio Sisternes whose work on generator-kubegen is the foundation of this work”

Have a look at this video to see the tool in action:

Please continue reading further if you want to give the tool a spin yourself.


The tool is based on Node and requires a recent version of Node (>=8.11.1). Verify the installed node version by running ‘node -v’. If the version is old, follow the instructions below to install latest release of Node.

On Mac

Download the installer package from the following link — https://nodejs.org/dist/v8.11.2/node-v8.11.2.pkg

On Linux (Intel)

Execute the following commands to install latest LTS release of Node on Ubuntu

$ sudo apt-get install python-software-properties
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
$ sudo apt-get install nodejs

On Linux (Power LE — ppc64le)

Execute the following commands to download and install latest Node version from the following link — https://nodejs.org/en/download/

$ wget https://nodejs.org/dist/v8.11.2/node-v8.11.2-linux-ppc64le.tar.xz
$ sudo mkdir -p /usr/local/lib/nodejs
$ sudo tar -xvf node-v8.11.2-linux-ppc64le.tar.xz -C /usr/local/lib/nodejs 
$ sudo mv /usr/local/lib/nodejs/node-v8.11.2-linux-ppc64le /usr/local/lib/nodejs/node-v8.11.2

Add /usr/local/lib/nodejs/node-v8.11.2/bin to the PATH environment variable. You can do this by adding the below lines to your /etc/profile (for a system-wide installation) or $HOME/.profile:

export NODEJS_HOME=/usr/local/lib/nodejs/node-v8.11.2/bin

Ensure you refresh the profile for the new settings to take effect.


Execute the following commands to install the tool on your system:

$ git clone https://github.com/bpradipt/generator-kubegen
$ sudo npm install -g yo
$ sudo npm install -g ./generator-kubegen

For validating the generated YAMLs, kubeval is used. Following are the steps to install kubeval.

On Mac

You can install using Homebrew:

$ brew tap garethr/kubeval
$ brew install kubeval

Or download the binary from the project release page:

$ wget https://github.com/garethr/kubeval/releases/download/0.7.1/kubeval-darwin-amd64.tar.gz
$ tar xf kubeval-darwin-amd64.tar.gz
$ sudo cp kubeval /usr/local/bin

On Linux (Intel)

Download the binary from the project release page:

$ wget https://github.com/garethr/kubeval/releases/download/0.7.1/kubeval-linux-amd64.tar.gz
$ tar xf kubeval-linux-amd64.tar.gz
$ sudo cp kubeval /usr/local/bin

On Linux (Power LE)

You’ll need to install golang and install kubeval from source.

Follow the steps mentioned below to install golang and setup GOPATH:

$ wget https://dl.google.com/go/go1.10.2.linux-ppc64le.tar.gz
$ sudo tar -C /usr/local -xzf go1.10.2.linux-ppc64le.tar.gz
$ mkdir -p $HOME/gopath

Add /usr/local/go/bin and $HOME/gopath/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile (for a system-wide installation) or $HOME/.profile:

export GOPATH=$HOME/gopath
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

Once golang and GOPATH is set, execute the following instruction to setup kubeval:

$ go get https://github.com/garethr/kubeval

Using the tool

Run the tool by executing the following command in a terminal:

$ yo kubegen

Follow the options on the terminal.

For validating the generated YAMLs start the program as follows:

$ yo kubegen --validate

Pradipta Kumar Banerjee

I'm a Cloud and Linux/ OpenSource enthusiast, with 16 years of industry experience at IBM. You can find more details about me here - Linkedin

You may also like...