Install Infrahub Collect
This guide shows you how to install Infrahub Collect on your system.
Prerequisites​
Before installing Infrahub Collect, ensure you have:
For Docker deployments:
- Administrative or sudo access on your system
- Docker with Docker Compose installed
For Kubernetes deployments:
- Administrative or sudo access on your system
- kubectl configured with permissions to read pod logs and execute commands in pods (
pods/logandpods/exec) in the Infrahub namespace
If building from source:
- Git and network access to clone the repository
- Go 1.21 or later installed
Installation methods​
- Direct Download
- Manual Selection
- Build from Source
Download the pre-built binary​
Download the pre-built binary directly:
# Download the appropriate binary for your system
curl https://infrahub.opsmill.io/ops/$(uname -s)/$(uname -m)/infrahub-collect -o infrahub-collect
# Make it executable
chmod +x infrahub-collect
# Move to a directory in your PATH (optional)
sudo mv infrahub-collect /usr/local/bin/
Select and download a specific version​
If you need a specific version or architecture, manually select the appropriate binary:
-
Identify your system architecture:
uname -s # Operating system (Linux/Darwin)uname -m # Architecture (x86_64/aarch64) -
Download the matching binary:
- Linux AMD64:
curl -L https://infrahub.opsmill.io/ops/Linux/x86_64/infrahub-collect -o infrahub-collect - Linux ARM64:
curl -L https://infrahub.opsmill.io/ops/Linux/aarch64/infrahub-collect -o infrahub-collect - macOS AMD64:
curl -L https://infrahub.opsmill.io/ops/Darwin/x86_64/infrahub-collect -o infrahub-collect - macOS ARM64:
curl -L https://infrahub.opsmill.io/ops/Darwin/arm64/infrahub-collect -o infrahub-collect
- Linux AMD64:
-
Make executable and optionally install system-wide:
chmod +x infrahub-collectsudo mv infrahub-collect /usr/local/bin/ # Optional
Build from source code​
To install Infrahub Collect, build from source:
-
Install Go 1.21 or later:
# Check if Go is installedgo version -
Clone the repository:
git clone https://github.com/opsmill/infrahub-ops-cli.gitcd infrahub-ops-cli -
Build the binaries:
make build -
Install to your PATH:
sudo cp bin/infrahub-collect /usr/local/bin/
The same binary collects from Docker Compose and Kubernetes deployments — there is no separate in-cluster installation. On Kubernetes, the tool runs from your workstation (or a CI runner) and reaches the cluster through kubectl.
Verify installation​
After installing the CLI, verify it is working correctly:
# Check versions
infrahub-collect version
# Verify environment detection
infrahub-collect environment detect
# Display help
infrahub-collect --help
Expected output:
Version: [git ref]
Configure environment​
Infrahub Collect uses environment variables for configuration. Set these based on your deployment:
Docker Compose deployments​
# Optional: Target a specific project
export INFRAHUB_PROJECT=infrahub-production
# Optional: Custom bundle location
export INFRAHUB_OUTPUT_DIR=/data/bundles/infrahub
Kubernetes deployments​
# Set the namespace
export INFRAHUB_K8S_NAMESPACE=infrahub
# Set kubeconfig if not default
export KUBECONFIG=/path/to/kubeconfig
Validation​
Confirm the CLI can connect to your Infrahub instance:
# List available deployments
infrahub-collect environment list
# Test environment detection
infrahub-collect environment detect
If these commands succeed, installation is complete.