⚠ Banzai CLI is a command line interface under heavy development for the Banzai Cloud Pipeline platform.

In its current state it is most suitable for making it easier to access and manage existing resources on your Pipeline Platform, and to automate operations. Depending on your goals, environment, preferences, and level of experience, the banzai CLI can be used either instead of, or as a supplement to using the public APIs of the platform directly, with our client library, or the web interface.

Getting started

Installation

Once the CLI tool will be initially released for the generic audience, we will provide prebuilt packages for more platforms. Until that you can install it using the following methods.

Using Brew on macOS

The easiest way to install the banzai CLI on a Mac is to use our Tap for Homebrew:

$ brew install banzaicloud/tap/banzai-cli

Using the pre-built binary

You can download our pre-built binaries from GitHub. For example on Linux:

wget https://github.com/banzaicloud/banzai-cli/releases/download/0.0.14/banzai_0.0.14_linux_amd64.tar.gz
tar xvzf banzai_0.0.14_linux_amd64.tar.gz
sudo install -m 755 banzai /usr/local/bin/

Building from source manually

If you have a golang environment ready, you can also build the tool yourself using the command below. The command will take care of downloading the source of the banzai CLI and its dependencies, and building an executable. For example on a recent Ubuntu you can install a Go environment able to compile banzai CLI with sudo apt install golang git.

$ go get github.com/banzaicloud/banzai-cli/cmd/banzai

You will find the executable file under your $GOPATH/bin directory (~/go/bin by default). To use the command as banzai, you can either add the directory to your PATH, or install it globally with a command like this:

$ sudo install ${GOPATH:-~/go}/bin/banzai /usr/local/bin

Login

To use the command you will have to log in. Its current implementation will ask you to copy and paste an OAuth token after you logged in to Pipeline in a web browser. You will also be able to select a default organization.

$ banzai login
? Pipeline endpoint: https://beta.banzaicloud.io/pipeline
? Please copy your Pipeline access token from the token field of https://beta.banzaicloud.io/pipeline/api/v1/token
? Pipeline token: [token]
? Organization: banzaicloud

Using kubectl on a Kubernetes cluster managed by Pipeline

The banzai CLI's cluster shell command starts a shell, or runs your specified program within the Kubernetes context of your cluster. You can either run the command without arguments to interactively select a cluster, and get an interactive shell, select the cluster with the --cluster-name flag, or specify the command to run.

$ banzai cluster shell
? Cluster: docs-example
INFO[0001] Running sh
[docs-example]$ helm list
NAME            REVISION    UPDATED                     STATUS      CHART                           APP VERSION NAMESPACE
dashboard       1           Wed Jan 16 12:42:15 2019    DEPLOYED    kubernetes-dashboard-0.8.0      1.10.0      pipeline-system
...
[docs-example]$ kubectl get nodes
NAME                                    STATUS   ROLES    AGE   VERSION
gke-docs-example-pool1-7a602b82-62w8    Ready    <none>   1h    v1.10.11-gke.1
gke-docs-example-system-a16f163c-dvwj   Ready    <none>   1h    v1.10.11-gke.1
[docs-example]$ exit
INFO[0026] Command exited successfully
$ banzai cluster shell --cluster-name docs-example kubectl get nodes
INFO[0000] Running kubectl kubectl get nodes
NAME                                    STATUS   ROLES    AGE   VERSION
gke-docs-example-pool1-7a602b82-62w8    Ready    <none>   43m   v1.10.11-gke.1
gke-docs-example-system-a16f163c-dvwj   Ready    <none>   43m   v1.10.11-gke.1
INFO[0001] Command exited successfully

Creating a cluster

If you have a create cluster request ready, you can simply pass it to the standard input of the banzai cluster create command. Alternatively you can answer the basic questions to prepare a query interactively. Please note that you will have to add the cloud provider specific properties manually in the current version.

Example:

$ banzai cluster create <<A
> {
>   "name": "docs-example",
>   "location": "us-central1-a",
>   "cloud": "google",
>   "secretName": "secret-name",
>   "properties": {
>     "gke": {
>       "master": {
>         "version": "1.10"
>       },
>       "nodePools": {
>         "pool1": {
>           "count": 1,
>           "instancetype": "n1-standard-1"
>         }
>       },
>       "nodeversion": "1.10"
>     }
>   }
> }
> A
INFO[0002] cluster is being created
INFO[0002] you can check its status with the command `banzai cluster get "docs-example"`
Id   Name
176  docs-example