Tuesday, 27 September 2022

Setup jsonnet-bundler in WSL2

 We need jsonnet-bundler to package the jsonnet projects For example, to generate the required Prometheus rules and Grafana dashboards in kubernetes-mixin project used for Kubernetes monitoring,  requires jsonnet-bundler. Let's see how we can setup jsonnet-bundler in Windows Subsystem for Linux (WSL2) to use it as a package tool.

Let's create a folder jb for jsonnet bundler as the first step.

We need to install upto date go language in WSL to install the jsonnet bundler. Execute below commands to setup go.

sudo apt-get update

sudo apt install golang-go

Update go lang.
git clone https://github.com/udhos/update-golang
cd update-golang/
sudo ./update-golang.sh

Then come out of the folder using cd .. Get jsonnet-bundler and install.

go mod init jb

go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest

go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb

Next we have to install jsonnet with the below command.

sudo apt install jsonnet

Close and open your WSL terminal and you have jsonnet-budler ready to use. Type jb and hit enter to see the availability of jsonnet-bundler.

No comments:

Popular Posts