VCF CLI Quick Start Guide
VCF CLI Quick Start Guide
This guide assumes you have already installed VCF CLI following the installation instructions. Here you'll learn how to set up contexts, perform basic operations, and understand the key workflows.
Context Types
VCF CLI uses contexts to store connection details for each environment. Two context types are supported:
| Type | Platform | Authentication |
|---|---|---|
cci |
VCF Automation | API token (generate in Tenant Portal under User Settings → API Tokens) |
k8s |
vSphere Supervisor | vCenter SSO credentials (prompted on first vcf context use) |
Context Setup
Each context stores connection details, credentials, and endpoint information.
Option A: VCF Automation (CCI Context)
# 1. Create API token in VCF Automation UI
# User Settings -> My Account -> API Tokens -> Generate
# 2. Create VCF Automation context
vcf context create myvcfa \
--endpoint https://vcfa.company.com \
--type cci \
--api-token <YOUR_API_TOKEN> \
--ca-certificate /path/to/ca-cert.pem
# 3. Switch to the context
vcf context use myvcfa
# 4. List available namespaces (contexts)
vcf context list
Option B: vSphere Supervisor (K8S Context)
# Create Supervisor context
vcf context create mysupervisor \
--endpoint https://supervisor.company.com \
--type k8s
# Switch to context (will prompt for vCenter SSO credentials)
vcf context use mysupervisor
Basic Usage Examples
Managing Contexts
# List all contexts
vcf context list
# Switch between contexts
vcf context use <context-name>
# Delete a context
vcf context delete <context-name>
Package Management
# Install package plugin
vcf plugin install package
# List available packages
vcf package available list
# Install a package
vcf package install myapp --package nginx --version 1.21.0
# List installed packages
vcf package installed list
Context Workflows
VCF Automation Context Workflow
# 1. Create VCF Automation org context
vcf context create vcfa-org \
--endpoint https://vcfa.company.com \
--type cci \
--api-token <token> \
--ca-certificate ca.pem
# 2. Context automatically creates namespace contexts for user's permissions:
# - vcfa-org (org-level operations)
# - vcfa-org:namespace1:project1 (namespace operations)
# 3. Switch to namespace context for cluster operations
vcf context use vcfa-org:namespace1:project1
# 4. Work with Kubernetes clusters
vcf cluster list
vcf cluster kubeconfig get cluster-name
vSphere Supervisor Context Workflow
# 1. Create Supervisor context
vcf context create supervisor \
--endpoint https://supervisor.company.com \
--type k8s
# 2. Creates contexts for accessible namespaces:
# - supervisor (cluster-level operations)
# - supervisor:namespace1 (namespace operations)
# 3. Switch to namespace context
vcf context use supervisor:namespace1
# 4. Work with workload clusters
vcf cluster list
vcf vm create test-vm --image ubuntu
Configuration
Configuration File
Configuration stored in: ~/.config/vcf/config.yaml (Linux/Mac)
or C:\Users\<USER>\.config\vcf\config.yaml (Windows)
Basic Configuration
# Set VCFA API token as environment variable
export VCF_CLI_VCFA_API_TOKEN=<your-token>
# Set configuration values
vcf config set env.VCF_CLI_VCFA_API_TOKEN <your-token>
# Configure proxy if needed
export HTTP_PROXY=http://proxy.company.com:8080
export HTTPS_PROXY=http://proxy.company.com:8080
Next Steps
- Explore Available Plugins: Run
vcf plugin searchto see functionality - CLI Command Reference: VCF CLI command reference in the techdocs portal
- Complete Documentation: Visit techdocs.broadcom.com for more details