### Example Kubernetes Cluster Output Source: https://github.com/civo/cli/blob/master/_autodocs/commands-kubernetes.md This is an example of the output you can expect after successfully creating a Kubernetes cluster, showing cluster details, node status, and installed applications. ```bash Created Kubernetes cluster my-cluster $ civo kubernetes show my-cluster ID : 1199efbe-e2a5-4d25-a32f-0b7aa50082b2 Name : my-cluster # Nodes : 3 Size : g4s.kube.medium Status : ACTIVE Version : 1.27.2+k3s1 API Endpoint : https://[IP]:6443 Master IP : [IP] DNS A record : 1199efbe-e2a5-4d25-a32f-0b7aa50082b2.k8s.civo.com Nodes: +------------------+----------------+--------+ | Name | IP | Status | +------------------+----------------+--------+ | kube-master-1e91 | [IP] | ACTIVE | | kube-node-e678 | [IP] | ACTIVE | +------------------+----------------+--------+ Installed marketplace applications: +------+-------+----------+----------+ | Name | Ver | Install | Categ | +------+-------+----------+----------+ | Traf | 2.9.4 | Yes | archit | | Redi | 7.2 | Yes | datab | +------+-------+----------+----------+ ``` -------------------------------- ### Install Civo CLI on Windows using Scoop Source: https://github.com/civo/cli/blob/master/README.md Add the 'extras' bucket to Scoop and then install the Civo CLI. ```sh scoop bucket add extras scoop install civo ``` -------------------------------- ### Setup Load Balancer Workflow Source: https://github.com/civo/cli/blob/master/_autodocs/commands-storage-loadbalancer.md Provides a sequence of Civo CLI commands to create a load balancer, add backend instances, configure listening rules, and verify the setup. ```bash # Create load balancer civo loadbalancer create --name web-lb --algorithm round_robin # Add backends civo loadbalancer backend add web-lb --instance server-1 --port 80 --weight 1 civo loadbalancer backend add web-lb --instance server-2 --port 80 --weight 1 civo loadbalancer backend add web-lb --instance server-3 --port 80 --weight 1 # Add rules civo loadbalancer rule create web-lb --protocol http --listen-port 80 --backend-port 80 civo loadbalancer rule create web-lb --protocol https --listen-port 443 --backend-port 8443 # Verify setup civo loadbalancer show web-lb civo loadbalancer backend list web-lb ``` -------------------------------- ### Install Kubernetes Application Source: https://github.com/civo/cli/blob/master/_autodocs/commands-kubernetes.md Installs a specified application from the marketplace to a target Kubernetes cluster. Dependencies are automatically handled. Use the --plan flag for applications with multiple size options. ```bash civo kubernetes applications add Longhorn --cluster=my-cluster civo kubernetes applications add MariaDB --cluster=my-cluster --plan 10GB ``` -------------------------------- ### Civo CLI Command Example Usage Source: https://github.com/civo/cli/blob/master/_autodocs/commands-additional.md Shows how to view example usage for specific Civo CLI commands, which is helpful for understanding command structure and common use cases. ```bash civo instance create --help # Usage: # civo instance create [HOSTNAME] [flags] # # Aliases: # create, new, add # # Examples: # civo instance create my-instance --size g4s.small --wait ``` -------------------------------- ### Start an Instance Source: https://github.com/civo/cli/blob/master/README.md Powers up a stopped instance. Use 'civo instance show' to monitor status. ```sh civo instance start api-demo.test ``` -------------------------------- ### Instance Module Structure Example Source: https://github.com/civo/cli/blob/master/_autodocs/overview.md Illustrates the typical file layout within a resource module, such as the instance module, showing the organization of command and operation files. ```go cmd/instance/ ├── instance.go # Main command, subcommand registration ├── instance_create.go # Create instance ├── instance_list.go # List instances ├── instance_show.go # Show instance details ├── instance_update.go # Update instance ├── instance_remove.go # Delete instance ├── instance_reboot.go # Reboot instance ├── instance_start.go # Start instance ├── instance_stop.go # Stop instance ├── instance_upgrade.go # Upgrade/resize instance ├── instance_firewall.go # Set firewall ├── instance_password.go # Get default password ├── instance_recovery.go # Recovery mode ├── instance_allowed_ips_update.go # Manage allowed IPs ├── instance_bandwidth_update.go # Set bandwidth limit ├── console.go # VNC console access └── ... additional operation files ``` -------------------------------- ### Install Civo CLI on macOS using Homebrew Source: https://github.com/civo/cli/blob/master/README.md Use Homebrew to tap the Civo tools repository and install the Civo CLI. ```sh brew tap civo/tools brew install civo ``` -------------------------------- ### Create Kubernetes Cluster with Specific Application Plans Source: https://github.com/civo/cli/blob/master/_autodocs/commands-kubernetes.md This example demonstrates how to create a cluster and specify plans for certain applications, such as MariaDB and Redis, indicating their required storage size. ```bash civo kubernetes create cluster-1 --applications "MariaDB:10GB,Redis:5GB" ``` -------------------------------- ### Install Civo CLI on Windows using Chocolatey Source: https://github.com/civo/cli/blob/master/README.md Install the Civo CLI using the Chocolatey package manager on Windows. ```sh choco install civo-cli ``` -------------------------------- ### Show Instance Details Using Variable Source: https://github.com/civo/cli/blob/master/_autodocs/INDEX.md This example demonstrates how to use a variable to store an instance ID and then display the instance's details. This is useful for scripting and automation. ```bash # Use in script with variable INSTANCE_ID="abc123def456" civo instance show $INSTANCE_ID ``` -------------------------------- ### Format a New Volume on Linux Source: https://github.com/civo/cli/blob/master/_autodocs/commands-storage-loadbalancer.md When attaching a new volume to a Linux instance, it needs to be partitioned and formatted. This example shows how to format a volume using ext4. ```bash mkfs.ext4 /dev/vdb ``` -------------------------------- ### Quota Management Example Output Source: https://github.com/civo/cli/blob/master/_autodocs/commands-database-account.md Illustrates the typical output format for the `civo quota` command, showing current resource usage against defined limits. ```bash Resource Current Quota Remaining Instances 5 20 15 CPU Cores 8 32 24 RAM (MB) 16384 65536 49152 SSD Disk (GB) 250 1000 750 Networks 2 10 8 Volumes 4 50 46 Load Balancers 1 10 9 Database Instances 2 10 8 ``` -------------------------------- ### Install Civo CLI on macOS/Linux via Shell Script Source: https://github.com/civo/cli/blob/master/README.md Download and execute the Civo CLI installation script directly from the Civo website. ```sh curl -sL https://civo.com/get | sh ``` -------------------------------- ### Verify Civo CLI Setup Source: https://github.com/civo/cli/blob/master/_autodocs/README.md These commands verify that the Civo CLI is correctly configured and can access your account resources. ```bash civo instance list civo region list civo quota ``` -------------------------------- ### Create Instance with Hostname Source: https://github.com/civo/cli/blob/master/_autodocs/INDEX.md Use this command to create a new Civo instance with a specified hostname and size. Ensure you have the necessary permissions and account setup. ```bash # Create instance with hostname "my-instance" civo instance create my-instance --size g4s.small ``` -------------------------------- ### Show Kubernetes Application Details Source: https://github.com/civo/cli/blob/master/README.md Displays post-installation instructions for a specific application installed on a cluster. Requires the application name and cluster name. ```sh civo kubernetes application show Traefik apps-demo-cluster ``` -------------------------------- ### Civo Instance Create Example Output Fields Source: https://github.com/civo/cli/blob/master/_autodocs/commands-instance.md Lists the available output fields when creating or showing Civo instance details. These fields provide comprehensive information about the instance's configuration and status. ```text id, hostname, size, region, public_ip, status, network_id, diskimage_id, initial_user, ssh_key, notes, firewall_id, tags, script, created_at, reverse_dns, private_ip, public_ip ``` -------------------------------- ### Get Civo CLI Help Source: https://github.com/civo/cli/blob/master/README.md Access context-sensitive help for Civo CLI commands and their options. ```sh civo help civo instance help civo instance create help ``` -------------------------------- ### Install Civo CLI on Linux using wget and tar Source: https://github.com/civo/cli/blob/master/README.md Download a specific release version of the Civo CLI for Linux using wget, extract it, make it executable, and move it to the system's PATH. ```sh wget https://github.com/civo/cli/releases/download/v1.0.40/civo-1.0.40-linux-amd64.tar.gz tar -xvf civo-1.0.40-linux-amd64.tar.gz chmod +x civo mv ./civo /usr/local/bin/ ``` -------------------------------- ### List Civo API Keys Source: https://github.com/civo/cli/blob/master/_autodocs/INDEX.md List available Civo API keys. This command is useful for verifying API key setup and managing authentication. ```bash civo apikey list ``` -------------------------------- ### Civo CLI Output Formatting Examples Source: https://github.com/civo/cli/blob/master/_autodocs/INDEX.md Demonstrates how to control the output format of Civo CLI commands, including default table format, JSON, pretty JSON, and custom fields. ```bash civo instance list ``` ```bash civo instance list -o json ``` ```bash civo instance list -o json --pretty ``` ```bash civo instance list -o custom -f hostname,status ``` -------------------------------- ### Civo Instance Create API Calls Source: https://github.com/civo/cli/blob/master/_autodocs/commands-instance.md Lists the primary API calls used internally by the `civo instance create` command. These are `NewInstanceConfig()` for getting default configuration and `CreateInstance()` for the actual instance creation. ```text NewInstanceConfig() - Get default configuration CreateInstance() - Create the instance with provided config ``` -------------------------------- ### Kubernetes Cluster Firewall Rules Syntax Source: https://github.com/civo/cli/blob/master/_autodocs/commands-kubernetes.md Illustrates the syntax for defining firewall rules, specifying ports and CIDR blocks. It shows examples for opening ports to the world, specific subnets, and using port ranges. ```bash 80,443,6443:0.0.0.0/0 ``` ```bash 8000-8100:1.2.3.4/24 ``` ```bash 80,443,6443 ``` ```bash all ``` -------------------------------- ### Create Kubernetes Cluster with Applications Source: https://github.com/civo/cli/blob/master/README.md Creates a new Kubernetes cluster and installs specified applications. List application names separated by commas. To exclude default applications, use the --remove-applications flag. ```sh civo kubernetes create apps-demo-cluster --nodes=2 --applications=Redis,Linkerd ``` ```sh civo kubernetes create apps-demo-cluster --nodes=2 --applications=Redis,Linkerd --remove-applications=metrics-server ``` -------------------------------- ### List All Firewalls Source: https://github.com/civo/cli/blob/master/README.md Get an overview of all configured firewalls. This command shows the firewall's ID, name, network, rule count, and associated instances, clusters, and load balancers. ```sh $ civo firewall list +--------------------------------------+--------------------+---------+-------------+-----------------+----------------+--------------------+ | ID | Name | Network | Total rules | Total Instances | Total Clusters | Total LoadBalancer | +--------------------------------------+--------------------+---------+-------------+-----------------+----------------+--------------------+ | 3ac0681d-2f71-4921-ae20-019272d9248b | Default (all open) | Default | 3 | 0 | 0 | 0 | +--------------------------------------+--------------+-------------+----------------+----------------+----------------+ ``` -------------------------------- ### Create Private Database Network with Firewall Source: https://github.com/civo/cli/blob/master/_autodocs/commands-network-firewall-domain.md This snippet shows how to create a private network for a database. It involves setting up an isolated network, a firewall that only allows access to the database port from within the same network, and launching an instance in this private setup. ```bash # Create isolated network civo network create --label db-net --cidr 10.3.0.0/24 # Create firewall (no external access) civo firewall create --name db-firewall --network db-net \ --create-rules "tcp:3306:10.3.0.0/24" # Create instance in private network civo instance create db-server --network db-net --firewall db-firewall ``` -------------------------------- ### Create Web Server with Firewall and Domain Source: https://github.com/civo/cli/blob/master/_autodocs/commands-network-firewall-domain.md This snippet demonstrates the workflow for setting up a web server. It includes creating a network, a firewall with rules for HTTP, HTTPS, and SSH, launching an instance, and configuring a domain name with an A record pointing to the instance's IP. ```bash # Create network civo network create --label web-net --cidr 10.2.0.0/24 # Create firewall with rules civo firewall create --name web-firewall --network web-net \ --create-rules "tcp:80:0.0.0.0/0;tcp:443:0.0.0.0/0;tcp:22:203.0.113.0/24" # Create instance in network with firewall civo instance create web-server \ --size g4s.small \ --network web-net \ --firewall web-firewall # Set up domain civo domain create example.com civo domain record create example.com --name www --type A --value ``` -------------------------------- ### List All Instance Sizes Source: https://github.com/civo/cli/blob/master/README.md Use this command to view all available instance sizes. The output includes details like name, description, type, CPU, RAM, and SSD. ```bash $ civo sizes list ``` -------------------------------- ### Create and Mount Volume Workflow Source: https://github.com/civo/cli/blob/master/_autodocs/commands-storage-loadbalancer.md Demonstrates the steps to create a Civo volume, attach it to an instance, and then format and mount it within the instance. ```bash # Create volume civo volume create --name data-vol --size 100 # Attach to instance civo volume attach data-vol --instance web-server # SSH to instance and format # mkfs.ext4 /dev/vdb # mkdir /mnt/data # mount /dev/vdb /mnt/data ``` -------------------------------- ### List Available Instance Sizes Source: https://github.com/civo/cli/blob/master/README.md Execute this command to view a list of all available instance sizes, detailing their names, descriptions, types, CPU cores, RAM, and SSD storage. This helps in choosing the appropriate size for your workload. ```sh $ civo size ls +--------------------+--------------------------------+------------+-----+---------+-----+ | Name | Description | Type | CPU | RAM | SSD | +--------------------+--------------------------------+------------+-----+---------+-----+ | g3.xsmall | Extra Small | Instance | 1 | 1024 | 25 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g3.small | Small | Instance | 1 | 2048 | 25 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g3.medium | Medium | Instance | 2 | 4096 | 50 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g3.large | Large | Instance | 4 | 8192 | 100 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g3.xlarge | Extra Large | Instance | 6 | 16384 | 150 | +--------------------+--------------------------------+------------+-----+---------+-----+ ``` -------------------------------- ### Get Instance Password Source: https://github.com/civo/cli/blob/master/_autodocs/commands-instance.md Retrieves the default username and password for an instance. Use the -o custom -f password flags to get only the password. ```bash civo instance password my-instance # Output: The instance my-instance (112f2407...) has the password BrbXNW2RUYLe (and user ubuntu) ``` ```bash civo instance password my-instance -o custom -f password # Output: BrbXNW2RUYLe ``` -------------------------------- ### List Available Instance and Node Sizes Source: https://github.com/civo/cli/blob/master/_autodocs/commands-database-account.md Lists all available sizes across different categories including instance, Kubernetes node, database, and GPU instance sizes. This command is useful for understanding resource options before provisioning. ```go var ( dbName string // Database name engine string // Database engine version string // Engine version size string // Instance size firewall string // Firewall reference network string // Network reference backupSchedule string // Cron expression backupRetention int // Retention days newPassword string // New password ) ``` -------------------------------- ### Install Bash Autocompletion Source: https://github.com/civo/cli/blob/master/README.md This command adds Civo's bash autocompletion script to your ~/.bashrc file. Ensure bash-completion is installed and sourced in your shell. ```sh echo 'source <(civo completion bash)' >>~/.bashrc ``` -------------------------------- ### Backup Instance Workflow Source: https://github.com/civo/cli/blob/master/_autodocs/commands-storage-loadbalancer.md Illustrates how to create a snapshot of an instance, list available snapshots, and restore an instance from a snapshot using Civo CLI. ```bash # Create snapshot civo snapshot create --source my-instance --source-type instance \ --name my-instance-backup-$(date +%Y%m%d) # List snapshots civo snapshot list # Restore from snapshot civo snapshot restore my-instance-backup-20250220 --name my-instance-restored ``` -------------------------------- ### Display Civo CLI Version Source: https://github.com/civo/cli/blob/master/_autodocs/commands-additional.md Shows the current installed version of the Civo CLI, including commit hash and build date. This command is useful for verifying your installation and checking for compatibility. ```text Civo CLI Version: 1.0.40 Commit: a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0 Date: 2025-02-20T15:30:00Z ``` -------------------------------- ### Start a Stopped Civo Instance Source: https://github.com/civo/cli/blob/master/_autodocs/commands-instance.md Powers on a Civo instance that is currently stopped. ```bash civo instance start ``` -------------------------------- ### Check Civo CLI Version Source: https://github.com/civo/cli/blob/master/RELEASE.md Verify the installed Civo CLI version and its build information. ```bash civo version # Shows: Civo CLI v{VERSION} civo version -v # Shows full build info including commit and date ``` -------------------------------- ### Get Instance Public IP Source: https://github.com/civo/cli/blob/master/_autodocs/commands-instance.md Fetches the public IP address associated with a specific instance. ```bash civo instance public-ip my-instance # Output: 74.220.21.246 ``` -------------------------------- ### Initialize Default Configuration Source: https://github.com/civo/cli/blob/master/_autodocs/configuration.md Creates a fresh default configuration file with standard settings, including a default region and API URL. The file is created with 0600 permissions. ```go func initializeDefaultConfig(filename string) ``` -------------------------------- ### Initialize Config File if Missing Source: https://github.com/civo/cli/blob/master/_autodocs/configuration.md Ensures the configuration file exists and is initialized with default values if it's missing. It creates the file with 0600 permissions and writes default JSON content. ```go func checkConfigFile(filename string) error ``` -------------------------------- ### List Available Instance Sizes Source: https://github.com/civo/cli/blob/master/README.md Call this command to retrieve a table of all available instance sizes. The output includes details such as name, description, type, CPU cores, RAM, and SSD storage. Results may vary based on the selected region. ```sh $ civo sizes list +--------------------+--------------------------------+------------+-----+---------+-----+ | Name | Description | Type | CPU | RAM | SSD | +--------------------+--------------------------------+------------+-----+---------+-----+ | g3.xsmall | Extra Small | Instance | 1 | 1024 | 25 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g3.small | Small | Instance | 1 | 2048 | 25 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g3.medium | Medium | Instance | 2 | 4096 | 50 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g3.large | Large | Instance | 4 | 8192 | 100 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g3.xlarge | Extra Large | Instance | 6 | 16384 | 150 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g3.2xlarge | 2X Large | Instance | 8 | 32768 | 200 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4s.kube.xsmall | Extra Small - Standard | Kubernetes | 1 | 1024 | 30 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4s.kube.small | Small - Standard | Kubernetes | 1 | 2048 | 40 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4s.kube.medium | Medium - Standard | Kubernetes | 2 | 4096 | 50 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4s.kube.large | Large - Standard | Kubernetes | 4 | 8192 | 60 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4p.kube.small | Small - Performance | Kubernetes | 4 | 16384 | 60 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4p.kube.medium | Medium - Performance | Kubernetes | 8 | 32768 | 80 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4p.kube.large | Large - Performance | Kubernetes | 16 | 65536 | 120 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4p.kube.xlarge | Extra Large - Performance | Kubernetes | 32 | 131072 | 180 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4c.kube.small | Small - CPU optimized | Kubernetes | 8 | 16384 | 60 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4c.kube.medium | Medium - CPU optimized | Kubernetes | 16 | 32768 | 80 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4c.kube.large | Large - CPU optimized | Kubernetes | 32 | 65536 | 120 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4c.kube.xlarge | Extra Large - CPU optimized | Kubernetes | 64 | 131072 | 180 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4m.kube.small | Small - RAM optimized | Kubernetes | 2 | 16384 | 60 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4m.kube.medium | Medium - RAM optimized | Kubernetes | 4 | 32768 | 80 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4m.kube.large | Large - RAM optimized | Kubernetes | 8 | 65536 | 120 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g4m.kube.xlarge | Extra Large - RAM optimized | Kubernetes | 16 | 131072 | 180 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g3.db.xsmall | Extra Small | Database | 1 | 2048 | 20 | +--------------------+--------------------------------+------------+-----+---------+-----+ | g3.db.small | Small | Database | 2 | 4096 | 40 | +--------------------+--------------------------------+------------+-----+---------+-----+ ``` -------------------------------- ### Generate Zsh Completion Script Source: https://github.com/civo/cli/blob/master/_autodocs/commands-additional.md Generates a zsh completion script for the Civo CLI. This script should be installed in the directory where zsh looks for completion functions. ```bash civo completion zsh | sudo tee /usr/share/zsh/site-functions/_civo ``` -------------------------------- ### List Instances Source: https://github.com/civo/cli/blob/master/_autodocs/commands-instance.md List all instances with default output. Use -o json for JSON output or -o custom with -f to specify fields. ```bash civo instance list ``` ```bash civo instance list -o json ``` ```bash civo instance list -o custom -f hostname,status,public_ip ``` -------------------------------- ### Civo CLI Instance Create Syntax Source: https://github.com/civo/cli/blob/master/_autodocs/README.md This shows the basic syntax for creating a Civo instance using the CLI. Refer to the flags table for available options. ```bash civo instance create [HOSTNAME] [flags] ``` -------------------------------- ### Add Application to Existing Kubernetes Cluster Source: https://github.com/civo/cli/blob/master/README.md Installs a new application onto an existing Kubernetes cluster. Specify the application name and the target cluster. ```sh civo kubernetes applications add Longhorn --cluster=apps-demo ``` -------------------------------- ### Build Civo CLI from Source Source: https://github.com/civo/cli/blob/master/README.md Clone the Civo CLI repository, build the binary using 'make', and add the build directory to your PATH. ```sh git clone https://github.com/civo/cli.git cd cli make cd .. cp -r cli $HOME export PATH="$HOME/cli:$PATH" ``` -------------------------------- ### Create a PostgreSQL Database Instance Source: https://github.com/civo/cli/blob/master/_autodocs/commands-database-account.md Use this command to create a new managed PostgreSQL database instance. It allows specifying the name, version, size, backup schedule, and retention period. The `--wait` flag ensures the command blocks until the database is ready. ```bash civo database create --name prod-db \ --engine postgresql \ --version 15 \ --size g3.db.medium \ --backup-schedule "0 2 * * *" \ --backup-retention 30 \ --wait ``` -------------------------------- ### Source Bash Completion Script Source: https://github.com/civo/cli/blob/master/README.md This command sources the bash-completion script, which is necessary for Civo's bash autocompletion to function correctly. Ensure bash-completion is installed. ```shell source /usr/share/bash-completion/bash_completion ``` -------------------------------- ### Load Configuration from File Source: https://github.com/civo/cli/blob/master/_autodocs/configuration.md Loads and initializes configuration from a specified file. This function checks for the file's existence, parses its JSON content, and handles environment variable overrides. ```go func loadConfig(filename string) ``` -------------------------------- ### Create a Domain Source: https://github.com/civo/cli/blob/master/_autodocs/commands-network-firewall-domain.md Use this command to register a new domain for DNS hosting with Civo. Ensure your domain registrar is configured to use Civo's nameservers. ```bash civo domain create example.com # Created a domain called example.com with ID 418181b2-fcd2-46a2-ba7f-c843c331e79b ``` -------------------------------- ### Get Kubernetes Cluster Configuration Source: https://github.com/civo/cli/blob/master/_autodocs/commands-kubernetes.md Retrieve or save the kubeconfig for a Kubernetes cluster. Use flags to control output, saving location, and kubectl context switching. ```bash civo kubernetes config my-cluster # Print to stdout civo kubernetes config my-cluster -s # Save to default location civo kubernetes config my-cluster -s --merge # Merge with existing civo kubernetes config my-cluster -p /tmp/config.yaml # Custom path civo kubernetes config my-cluster -s --switch # Auto-switch context ``` -------------------------------- ### List Kubernetes Sizes Source: https://github.com/civo/cli/blob/master/README.md Run this command to display a table of all available Kubernetes instance sizes, including their CPU, RAM, and storage specifications. ```sh $ civo kubernetes size +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | Name | Description | Type | CPU Cores | RAM MB | SSD GB | Selectable | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4s.kube.xsmall | Extra Small - Standard | Kubernetes | 1 | 1024 | 30 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4s.kube.small | Small - Standard | Kubernetes | 1 | 2048 | 40 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4s.kube.medium | Medium - Standard | Kubernetes | 2 | 4096 | 50 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4s.kube.large | Large - Standard | Kubernetes | 4 | 8192 | 60 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4p.kube.small | Small - Performance | Kubernetes | 4 | 16384 | 60 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4p.kube.medium | Medium - Performance | Kubernetes | 8 | 32768 | 80 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4p.kube.large | Large - Performance | Kubernetes | 16 | 65536 | 120 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4p.kube.xlarge | Extra Large - Performance | Kubernetes | 32 | 131072 | 180 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4c.kube.small | Small - CPU optimized | Kubernetes | 8 | 16384 | 60 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4c.kube.medium | Medium - CPU optimized | Kubernetes | 16 | 32768 | 80 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4c.kube.large | Large - CPU optimized | Kubernetes | 32 | 65536 | 120 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4c.kube.xlarge | Extra Large - CPU optimized | Kubernetes | 64 | 131072 | 180 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4m.kube.small | Small - RAM optimized | Kubernetes | 2 | 16384 | 60 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4m.kube.medium | Medium - RAM optimized | Kubernetes | 4 | 32768 | 80 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4m.kube.large | Large - RAM optimized | Kubernetes | 8 | 65536 | 120 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4m.kube.xlarge | Extra Large - RAM optimized | Kubernetes | 16 | 131072 | 180 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4g.kube.small | Small - Nvidia A100 80GB | Kubernetes | 12 | 131072 | 100 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4g.kube.medium | Medium - Nvidia A100 80GB | Kubernetes | 24 | 262144 | 100 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4g.kube.large | Large - Nvidia A100 80GB | Kubernetes | 48 | 524288 | 100 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ | g4g.kube.xlarge | Extra Large - Nvidia A100 80GB | Kubernetes | 96 | 1048576 | 100 | Yes | +--------------------+--------------------------------+------------+-----------+---------+--------+------------+ ``` -------------------------------- ### Create and Access PostgreSQL Database Source: https://github.com/civo/cli/blob/master/_autodocs/commands-database-account.md Create a PostgreSQL database, retrieve its credentials, and connect to it locally. ```bash # Create PostgreSQL database civo database create --name prod-db \ --engine postgresql \ --size g3.db.small \ --wait # Get credentials civo database credential show prod-db # Connect from local psql -h prod-db.db.civo.com -U admin -d prod_db ``` -------------------------------- ### Display GitHub Issue Message Source: https://github.com/civo/cli/blob/master/_autodocs/types-and-utilities.md Prints a standard error message that includes a link to the GitHub issues page. This is used to guide users on where to report problems. ```go func IssueMessage() ``` -------------------------------- ### CheckVersionUpdate() Source: https://github.com/civo/cli/blob/master/_autodocs/types-and-utilities.md Checks for a newer version of the Civo CLI available on GitHub and notifies the user if an update is found. It compares the latest release with the currently installed binary version. ```APIDOC ## CheckVersionUpdate() ### Description Check GitHub for newer CLI version and notify user. ### Behavior 1. Gets latest release from GitHub 2. Compares with binary version 3. Prints message if newer version available ``` -------------------------------- ### List Available Kubernetes Node Sizes Source: https://github.com/civo/cli/blob/master/_autodocs/commands-kubernetes.md Lists all available node sizes for creating Kubernetes clusters. Use this command to understand the different instance types, their specifications (CPU, RAM, SSD), and whether they are selectable for new clusters. ```bash civo kubernetes size [flags] ``` -------------------------------- ### Generate Bash Completion Script Source: https://github.com/civo/cli/blob/master/_autodocs/commands-additional.md Generates a bash completion script for the Civo CLI. This script should be installed in the appropriate directory for your system's bash completion to work. ```bash civo completion bash | sudo tee /usr/local/etc/bash_completion.d/civo ``` -------------------------------- ### Create Civo Instance Source: https://github.com/civo/cli/blob/master/README.md Use this command to create a new Civo instance. Specify hostname, size, disk image, initial user, allowed IPs, and network bandwidth limit. The command waits for the instance to be ready. ```sh civo instance create --hostname=api-demo.test --size g4s.small --diskimage=ubuntu-noble --initialuser=demo-user --allowed-ips 192.168.1.100,192.168.1.101 --network-bandwidth-limit 100 ``` -------------------------------- ### Show Database Instance Details and Connection Info Source: https://github.com/civo/cli/blob/master/_autodocs/commands-database-account.md This command displays detailed information about a specific database instance, including its ID, name, engine, version, status, size, region, connection details (hostname, port, username), and backup settings. The password is not shown directly for security reasons. ```bash civo database show prod-db ``` -------------------------------- ### Create Snapshot from Instance Source: https://github.com/civo/cli/blob/master/_autodocs/commands-storage-loadbalancer.md Use this command to create a snapshot of a specific instance. Provide the instance name or ID and an optional description for the snapshot. ```bash civo snapshot create --source my-instance --source-type instance --description "Pre-upgrade backup" ``` -------------------------------- ### Generate Shell Completion Scripts Source: https://github.com/civo/cli/blob/master/_autodocs/INDEX.md Generate and install shell completion scripts for bash, zsh, fish, and PowerShell to improve command-line usability. This provides auto-completion for Civo CLI commands. ```bash civo completion bash | sudo tee /usr/local/etc/bash_completion.d/civo civo completion zsh | sudo tee /usr/share/zsh/site-functions/_civo civo completion fish | sudo tee /usr/share/fish/vendor_completions.d/civo.fish civo completion powershell # PowerShell ``` -------------------------------- ### View Instance Password Source: https://github.com/civo/cli/blob/master/README.md Retrieve the default user password for an instance using its ID or hostname. Use the `-o custom -f Password` flags to get only the password, which is useful for scripting. ```sh $ civo instance password api-demo.test The instance api-demo.test (112f2407-fb89-443e-bd0e-5ddabc4682c6) has the password BrbXNW2RUYLe (and user demo-user) ``` ```sh $ civo instance password api-demo.test -o custom -f Password BrbXNW2RUYLe ``` -------------------------------- ### Create a PostgreSQL Database Source: https://github.com/civo/cli/blob/master/doc/DTABASE_BACKUP_RESTORE.md Use this command to create a new PostgreSQL database instance with specified size, software, and version. ```bash ❯ civo database create postgres-demo --size g3.db.medium --software PostgreSQL --version 14 Database (postgres-demo) with ID 65dd8173-f754-4c6c-b50a-7ddb6d5446c5 has been created ``` -------------------------------- ### Database Backup Strategy Source: https://github.com/civo/cli/blob/master/_autodocs/commands-database-account.md Configure automatic daily backups, create manual backups, list existing backups, and restore a database from a backup. ```bash # Set automatic daily backups civo database create my-db --backup-schedule "0 2 * * *" --backup-retention 30 # Create manual backup before major operation civo database backup create my-db --name before-migration # Verify backups civo database backup list my-db # Restore if needed civo database restore my-db --name my-db-restored ``` -------------------------------- ### Civo CLI Configuration File Structure Source: https://github.com/civo/cli/blob/master/_autodocs/overview.md Example structure of the Civo CLI configuration file, typically located at ~/.civo.json. This file stores API keys, metadata, and region-specific features. ```json { "apikeys": { "key_name": "api_key_value" }, "meta": { "admin": false, "current_apikey": "key_name", "default_region": "LON1", "latest_release_check": "2025-02-20T10:00:00Z", "url": "https://api.civo.com", "last_command_executed": "2025-02-20T15:30:00Z" }, "region_to_features": { "LON1": { "features": [...] } } } ``` -------------------------------- ### Check for CLI Version Updates Source: https://github.com/civo/cli/blob/master/_autodocs/types-and-utilities.md Checks the GitHub repository for a newer version of the Civo CLI and notifies the user if an update is available. It compares the latest release with the currently installed binary version. ```go func CheckVersionUpdate() ``` -------------------------------- ### Create Instance Snapshot Source: https://github.com/civo/cli/blob/master/README.md Use this command to create a point-in-time copy of an instance. You can optionally provide a name and description for the snapshot. ```sh $ civo instance snapshot create INSTANCE_NAME [flags] Flags: -n, --name string The name of the snapshot (default: auto-generated) -d, --description string Description for the snapshot ``` -------------------------------- ### List Database Sizes Source: https://github.com/civo/cli/blob/master/_autodocs/commands-database-account.md Lists all available database instance sizes, including their name, description, CPU cores, RAM, and SSD storage. ```APIDOC ## List Database Sizes ### Description Lists all available database instance sizes, including their name, description, CPU cores, RAM, and SSD storage. ### Command `civo database size [flags]` ### Output Columns - **Name** (string) - Size identifier. - **Description** (string) - Human-readable name. - **CPU Cores** (int) - vCPU count. - **RAM MB** (int) - Memory in MB. - **SSD GB** (int) - Storage in GB. ``` -------------------------------- ### Get Default API Key Source: https://github.com/civo/cli/blob/master/_autodocs/configuration.md Retrieves the currently active API key value from the configuration. Returns an empty string if no API key is set or if the current API key identifier is empty. ```go func DefaultAPIKey() string ``` -------------------------------- ### List Available Kubernetes Applications Source: https://github.com/civo/cli/blob/master/README.md Run this command to retrieve an up-to-date list of applications available for deployment on Civo Kubernetes. The output displays application name, version, category, supported plans, and dependencies. ```bash civo kubernetes apps list ``` ```text +-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+ | Name | Version | Category | Plans | Dependencies | +-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+ | acorn | 0.7.1 | management | Disabled Auto-TLS, Enabled Auto-TLS | | +-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+ | ambassador-edge-stack | 3.8.0 | architecture | | | +-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+ | apisix-ingress-controller | 1.6.0 | architecture | | | +-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+ | argo-rollouts | v1.4.1 | ci_cd | | | +-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+ | argo-workflows | v3.0.3 | ci_cd | | | +-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+ | argocd | v2.11.4 | ci_cd | | | +-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+ | aspnet | 5.0.5 | management | | | +-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+ | atmo | 0.2.2 | architecture | | | +-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+ | bitwarden-passwordless-dev | 1.0.74 | management | | cert-manager | +-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+ | bitwarden-unified | 2024.1.0 | management | | cert-manager | +-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+ | blackbox-exporter | 5.8.2 | monitoring | | | +-----------------------------+-------------------+--------------+--------------------------------------------------------------------------------------------+-----------------------------------+ ``` -------------------------------- ### Enable Instance Recovery Mode Source: https://github.com/civo/cli/blob/master/_autodocs/commands-instance.md Use this command to boot an instance into its recovery environment for troubleshooting purposes. ```bash civo instance recovery enable ``` -------------------------------- ### List Available K3s Versions for Cluster Creation Source: https://github.com/civo/cli/blob/master/_autodocs/commands-kubernetes.md Retrieves a list of K3s versions that are currently available for provisioning new Kubernetes clusters. This helps in selecting the desired K3s version during cluster setup. ```bash civo kubernetes available-versions ``` -------------------------------- ### Show Instance Details Source: https://github.com/civo/cli/blob/master/_autodocs/commands-instance.md Display details for a specific instance using its ID or hostname. Supports JSON output. ```bash civo instance show my-instance ``` ```bash civo instance show 112f2407-fb89-443e-bd0e-5ddabc4682c6 ``` ```bash civo instance show my-instance -o json ``` -------------------------------- ### Add Application Requiring a Plan to Kubernetes Cluster Source: https://github.com/civo/cli/blob/master/README.md Installs a database application that requires a storage plan. If a plan is not specified, the CLI will prompt for one. You can also specify the plan directly using 'ApplicationName:PlanSize'. ```sh civo kubernetes applications add mariadb --cluster=apps-demo ``` ```sh MariaDB:10GB ``` -------------------------------- ### Civo CLI Command Structure Source: https://github.com/civo/cli/blob/master/_autodocs/overview.md Illustrates the general syntax for using the Civo CLI, including commands, subcommands, flags, and arguments. ```bash civo [subcommand] [flags] [args] ``` -------------------------------- ### Create Kubernetes Cluster with Full Configuration Source: https://github.com/civo/cli/blob/master/_autodocs/commands-kubernetes.md Use this command to create a new Kubernetes cluster with specified nodes, size, CNI plugin, applications, firewall rules, network, and version. Flags like `--wait`, `--save`, `--merge`, and `--switch` control the post-creation behavior. ```bash civo kubernetes create my-cluster \ --nodes 3 \ --size g4s.kube.medium \ --cni-plugin flannel \ --applications Redis,Linkerd \ --remove-applications Traefik-v2-nodeport \ --create-firewall \ --firewall-rules "80,443,6443;8000-8100:1.2.3.4" \ --network default \ --version latest \ --wait \ --save \ --merge \ --switch ``` -------------------------------- ### Civo CLI Non-Interactive Mode for Scripting Source: https://github.com/civo/cli/blob/master/_autodocs/commands-additional.md Provides examples of using the Civo CLI in non-interactive mode for scripting and automation, including creating resources without prompts and piping output to other tools like jq. ```bash # No prompts, output JSON civo instance create --hostname server-1 --size g4s.small --yes -o json ``` ```bash # Pipe to tools civo instance list -o json | jq '.[] | select(.status=="ACTIVE")' ``` -------------------------------- ### Create PostgreSQL Backup (Default) Source: https://github.com/civo/cli/blob/master/doc/DTABASE_BACKUP_RESTORE.md Creates a default backup for a PostgreSQL database. If no name or type is specified, it defaults to a manual backup. ```bash ❯ civo database backups create postgres-demo ``` -------------------------------- ### Create Civo Object Store Source: https://github.com/civo/cli/blob/master/README.md Create a new object store with a specified name. The default size is 500GB; use the --size flag to change it. If no region is specified, it uses the active region. ```sh $ civo objectstore create cli-demo Creating Object Store cli-demo in LON1 To check the status of the Object Store run: civo objectstore show cli-demo ``` -------------------------------- ### Create Manual PostgreSQL Backup Source: https://github.com/civo/cli/blob/master/doc/DTABASE_BACKUP_RESTORE.md Initiates a manual backup for a PostgreSQL database with a specified name. ```bash ❯ civo database backups create postgres-dem --name firstbackup --type manual Database backup (firstbackup) for database postgres-demo has been created ```