Install kbcli
You can install kbcli on your laptop or virtual machines on the cloud.
Environment preparation
For Windows users, PowerShell version should be 5.0 or higher.
Install kbcli
kbcli now supports macOS, Windows, and Linux.
- macOS
- Windows
- Linux
You can install kbcli with curl
or brew
.
- Option 1: Install kbcli using the
curl
command.
Install kbcli.
curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash
If you want to install kbcli with a specified version, follow the steps below.
Check the available versions in kbcli Release.
Specify a version with
-s
and run the command below.curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash -s x.y.z
You can view all versions of kbcli, including alpha and beta releases, on the kbcli releases list.
To get stable releases, use this command:
curl -s "https://api.github.com/repos/apecloud/kbcli/releases?per_page=100&page=1" | jq -r '.[] | select(.prerelease == false) | .tag_name' | sort -V -r
noteBy default, kbcli installs the latest release version. However, if you already have a running KubeBlocks instance, you need to install a matching version of kbcli.
For example, if your existing KubeBlocks deployment is v0.8.3, you should install kbcli v0.8.3 instead of a higher version like v0.9.0, as mismatched versions may lead to errors.
Run
kbcli version
to check the version of kbcli and ensure that it is successfully installed.noteIf a timeout exception occurs during installation, please check your network settings and retry.
- Option 2: Install kbcli using Homebrew.
Install ApeCloud tap, the Homebrew package of ApeCloud.
brew tap apecloud/tap
Install kbcli.
brew install kbcli
If you want to install kbcli with a specified version, run the commands below.
# View the available version
brew search kbcli
# Specify a version
brew install kbcli@x.y.zVerify that kbcli is successfully installed.
kbcli -h
There are two ways to install kbcli on Windows:
- Option 1: Install using the script.
By default, the script will be installed at C:\Program Files\kbcli-windows-amd64 and cannot be modified.
If you need to customize the installation path, use the zip file.
Run PowerShell as an administrator and execute
Set-ExecutionPolicy Unrestricted
.Install kbcli.
The following script will automatically install the environment variables at C:\Program Files\kbcli-windows-amd64.
powershell -Command " & ([scriptblock]::Create((iwr https://www.kubeblocks.io/installer/install_cli.ps1)))"
To install a specified version of kbcli, use
-v
after the command and describe the version you want to install.powershell -Command " & ([scriptblock]::Create((iwr https://www.kubeblocks.io/installer/install_cli.ps1))) -v 0.5.2"
- Option 2: Install using the installation package.
- Download the kbcli installation zip package from kbcli Release.
- Extract the file and add it to the environment variables.
- Click the Windows icon and select System Settings.
- Click Settings -> Related Settings -> Advanced system settings.
- Click Environment Variables on the Advanced tab.
- Click New to add the path of the kbcli installation package to the user and system variables.
- Click Apply and OK.
Install kbcli using the curl
command.
Install kbcli.
curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash
Run
kbcli version
to check the version of kbcli and ensure that it is successfully installed.
- If a timeout exception occurs during installation, please check your network settings and retry.
(Optional) Enable auto-completion for kbcli
kbcli
supports command line auto-completion.
# Configure SHELL-TYPE as one type from bash, fish, PowerShell, and zsh
kbcli completion SHELL-TYPE -h
For example, enable kbcli auto-completion for zsh.
Steps:
Check the user guide.
kbcli completion zsh -h
Enable the completion function of your terminal first.
echo "autoload -U compinit; compinit" >> ~/.zshrc
Enable the
kbcli
automatic completion function.echo "source <(kbcli completion zsh); compdef _kbcli kbcli" >> ~/.zshrc