Production-ready, cross-platform script to install and uninstall dependencies for Nutanix Kubernetes Provisioning (NKP) on Linux and macOS. One script handles both install and uninstall (with --uninstall).
Quick start (run from GitHub):
curl -fsSL https://raw.githubusercontent.com/lTSPV75BRO/NKP_Scripts/main/install-nkp-deps.sh | bash| Component | Purpose |
|---|---|
| Docker | Container runtime for NKP |
| kubectl | Kubernetes CLI (stable release) |
| Helm | Kubernetes package manager |
| Velero | Backup and restore for Kubernetes (vmware-tanzu/velero); macOS: Homebrew, Linux: latest release tarball |
| NKP CLI | Nutanix NKP tool (from URL you provide) |
After installation, the script verifies each component and reports versions. Optional minimum-version checks can warn if versions are below recommended levels.
- Linux: Debian/Ubuntu (apt), RHEL/CentOS/Rocky/Alma (dnf/yum), Fedora — Docker from official distro repos; other distros use the get.docker.com script
- macOS: Intel (amd64) and Apple Silicon (arm64); Docker, kubectl, Helm, and Velero via Homebrew (
brew install --cask docker,brew install kubectl,brew install helm,brew install velero) - Architectures: amd64 (x86_64), arm64 (aarch64)
- Linux:
sudoand one of apt, dnf, or yum. The script installs curl, wget, tar, git (and ca-certificates). If the package manager fails (e.g. "No URLs in mirrorlist"), fix repos or install these tools manually. Docker install must succeed or the script exits. - macOS: Homebrew (for Docker); curl is built-in
If the installer fails with No URLs in mirrorlist (baseos/appstream unreachable), fix the repo files then re-run:
# Backup repo directory
sudo cp -r /etc/yum.repos.d /etc/yum.repos.d.bak
# Rocky Linux: comment mirrorlist and use baseurl (use lowercase rocky*.repo)
sudo sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/rocky*.repo
sudo sed -i 's/^#baseurl/baseurl/g' /etc/yum.repos.d/rocky*.repo
# Refresh cache
sudo dnf clean all && sudo dnf makecacheThen run the installer again.
You can run the installer without cloning the repo:
curl -fsSL https://raw.githubusercontent.com/lTSPV75BRO/NKP_Scripts/main/install-nkp-deps.sh | bashTo pass options to the script, use **bash -s --** (note the space and double dash), then the script options:
# Show help (must use "bash -s -- --help", not "bash -s --help")
curl -fsSL https://raw.githubusercontent.com/lTSPV75BRO/NKP_Scripts/main/install-nkp-deps.sh | bash -s -- --help
# Install, skip Docker, dry-run
curl -fsSL https://raw.githubusercontent.com/lTSPV75BRO/NKP_Scripts/main/install-nkp-deps.sh | bash -s -- --skip-docker --dry-run
# Install with NKP URL (non-interactive)
curl -fsSL https://raw.githubusercontent.com/lTSPV75BRO/NKP_Scripts/main/install-nkp-deps.sh | bash -s -- --nkp-url "https://download.nutanix.com/..."
# Uninstall (prompts for which components)
curl -fsSL https://raw.githubusercontent.com/lTSPV75BRO/NKP_Scripts/main/install-nkp-deps.sh | bash -s -- --uninstall
# Verify only (no install)
curl -fsSL https://raw.githubusercontent.com/lTSPV75BRO/NKP_Scripts/main/install-nkp-deps.sh | bash -s -- --verify-onlyNote: Piping from the internet runs the script in your environment. Use only from trusted sources. Prefer downloading and inspecting the script when in doubt.
# Make executable (once)
chmod +x install-nkp-deps.sh
# Full install (will prompt for NKP URL)
./install-nkp-deps.sh
# Non-interactive: provide NKP URL
./install-nkp-deps.sh --nkp-url "https://portal.nutanix.com/..."
# Skip components you already have
./install-nkp-deps.sh --skip-docker --skip-kubectl
# Only verify already-installed tools
./install-nkp-deps.sh --verify-only
# Preview what would run (no changes)
./install-nkp-deps.sh --dry-runUninstall is built into the same script. Use --uninstall; with no component flags, it prompts which to remove.
# Interactive: choose which components to uninstall (d/k/h/v/n or names, or 'all'/'none')
./install-nkp-deps.sh --uninstall
# Uninstall specific components (no prompt)
./install-nkp-deps.sh --uninstall --kubectl --nkp
./install-nkp-deps.sh --uninstall --allUninstall also removes the NKP Scripts completion/alias block from ~/.bashrc/~/.zshrc and reminds you to run hash -r (bash) or rehash (zsh) so uninstalled commands are no longer looked up from cache.
You can also run ./uninstall-nkp-deps.sh (wrapper that calls install-nkp-deps.sh --uninstall).
Option (with --uninstall) |
Component |
|---|---|
--docker |
Docker (package/cask removal on Linux/macOS) |
--kubectl |
kubectl binary (from install script location) |
--helm |
Helm binary |
--velero |
Velero binary |
--nkp |
NKP CLI binary |
--all |
All five components |
| Option | Description |
|---|---|
--skip-docker |
Do not install or start Docker |
--skip-kubectl |
Do not install kubectl |
--skip-helm |
Do not install Helm |
--skip-velero |
Do not install Velero |
--skip-nkp |
Do not install NKP CLI |
--nkp-url URL |
NKP download URL (avoids prompt) |
--nkp-version X.Y |
Use Docker/kubectl/Helm versions recommended for NKP X.Y (e.g. 2.17). Auto-set when using --nkp-url if version is in URL. |
--dry-run |
Log actions only; do not install |
--verify-only |
Only run version checks; do not install |
--log-file PATH |
Log file path (default: install-nkp-deps.log) |
-h, --help |
Show help |
Obtain the NKP CLI download URL from the Nutanix support portal or your Nutanix representative. Expected tarball names:
| Platform | Example filename |
|---|---|
| Linux (amd64) | nkp_v2.17.0_linux_amd64.tar.gz |
| Linux (arm64) | nkp_v2.17.0_linux_arm64.tar.gz |
| macOS (Intel) | nkp_v2.17.0_darwin_amd64.tar.gz |
| macOS (Apple Silicon) | nkp_v2.17.0_darwin_arm64.tar.gz |
The script supports:
- Tarball (
.tar.gz): extracts and installs thenkpbinary from inside (e.g.nkp_v2.17.0_linux_amd64/nkp) - Direct binary: installed as
nkpin/usr/local/bin
If a component is already installed but not in the script’s default location (e.g. kubectl in ~/.local/bin), the script still installs or upgrades it into the default location (/usr/local/bin on Linux, or /opt/homebrew/bin on macOS when using Homebrew). The script only skips installation when the component is already at the target version and lives in that default location.
After install, the script prints:
- Docker – server version (or client if no daemon)
- kubectl – client version
- Helm – version
- Velero – client version
- NKP – output of
nkp versionor “installed”
If any requested component is missing from PATH, the script exits with a non-zero status. Optional minimum versions (Docker ≥ 20.10, kubectl ≥ 1.24, Helm ≥ 3.10) are checked and a warning is printed if below.
All operations are logged to stderr and to a log file. The default log file is in the system temp directory ($TMPDIR on macOS, /tmp on Linux) as install-nkp-deps.<pid>.log. Override with --log-file PATH.
- Shell completions and alias: The script adds a small block to your
~/.bashrcor~/.zshrconly for tools that don’t already have completion in the file (idempotent). It also ensures the systembash-completionpackage is loaded so_get_comp_words_by_refis defined. Bash also gets aliask=kubectlwhen kubectl completion is added. Reopen your terminal or runsource ~/.bashrc/source ~/.zshrcto use them. _get_comp_words_by_ref: command not foundwhen runningnkp/k/helm: Add these two lines right after the line# --- NKP Scripts - completions and alias ...in your~/.bashrc(and install bash-completion if you want full completion:sudo dnf install -y bash-completionorsudo apt install -y bash-completion):Then run[ -f /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion 2>/dev/null || true type _get_comp_words_by_ref &>/dev/null || function _get_comp_words_by_ref { :; }
source ~/.bashrcor open a new terminal. Alternatively, remove the NKP Scripts block from~/.bashrcand re-run the installer so it adds the updated block.korkubectlsays "No such file or directory": Your shell may be using a cached path to an old binary (e.g. one that was in~/.local/bin). Runhash -r(bash) orrehash(zsh), or open a new terminal. New installs add a hash clear so this is less likely.- Linux (Docker): If the script adds your user to the
dockergroup, log out and back in (or runnewgrp docker) so you can rundockerwithoutsudo.
Contributions are welcome. Please read CONTRIBUTING.md for how to report issues, suggest changes, and submit pull requests.
To test the script on different OSes (Ubuntu, Debian, RHEL/Fedora, macOS) and in CI, see TESTING.md. It includes a test matrix, quick commands (--help, --dry-run, --verify-only), and a manual checklist.
This project is licensed under the MIT License — see the LICENSE file for the full text. You may use, modify, and distribute it under those terms.
Nutanix NKP (the CLI and platform installed by this script) is subject to Nutanix licensing and support terms; this repo only provides the installer/uninstaller scripts.