Working with the Civo CLI
Civo Academy - How to Create a Kubernetes Cluster using Civo CLI
Description
With Civo Academy, learn how to install, access, and use the Civo CLI to create a Kubernetes cluster.
The Civo Command Line Interface (CLI) is an essential tool for developers looking to streamline their Kubernetes workflow. This lesson will walk you through the process of installing, accessing, and using the Civo CLI to create a Kubernetes cluster.
Introduction to Civo CLI
Civo CLI is a powerful tool that allows you to interact with your Civo Kubernetes clusters directly from your terminal. It's available across various operating systems and can be found in the open-source GitHub repository. Whether you're using Homebrew on macOS or curl on another system, installing the Civo CLI is a straightforward process.
Installing the Civo CLI
To install the Civo CLI using Homebrew on macOS, run the following command:
bash
brew tap civo/tools; brew install civo
Alternatively, you can install the Civo CLI using curl with the following command:
bash
curl -sL https://civo.com/get | sh
To verify that the Civo CLI is installed correctly, run the `civo` command. This will display all the available commands and their descriptions.
Accessing Your Account Using Civo CLI
To access your Civo account using the CLI, you need to set an API key. You can find your Civo API key under the "Authentication" section at `civo.com/api#authentication`.
To add the API key to your CLI, run the following command:
bash
civo apikey add [name] [key]
Replace [name]
with a name for the key and [key]
with your actual API key. To set this key as your default, use the following command:
bash
civo apikey current [name]
Replace [name]
with the name you used when adding the key.
Creating a Kubernetes Cluster Using Civo CLI
Creating a Kubernetes cluster using the Civo CLI is as simple as running a single command. Here's an example:
bash
civo kubernetes create [name] -size=[size] -nodes=[number] -wait
Replace [name]
, [size]
, and [number]
with the name of your cluster, the size of the instances, and the number of nodes, respectively. The `-wait` flag tells the CLI to wait until the cluster is created before returning control to the terminal.
You can view the details of your newly created cluster with the following command:
bash
civo kubernetes show [cluster_name]
Replace [cluster_name]
with the name of your cluster.
Exploring Other Commands and Deleting the Cluster
The Civo CLI offers a wide range of commands for managing your Kubernetes clusters. You can scale your cluster, add applications from the Civo marketplace, and even delete your cluster. To view all available applications in the Civo marketplace, use the following command:
bash
civo kubernetes applications list
To delete a cluster, use the following command:
bash
civo kubernetes remove [cluster_name]
Replace [cluster_name]
with the name of the cluster you want to delete.
For more information about Civo CLI refer to Civo CLI documentation.
These may also be of interest
Deploy your first Kubernetes application through CLI
Deploy your first Kubernetes app with ease using kubectl. This step-by-step guide provides a smooth introduction to cluster configuration, resource definition, deployment, and testing.
Guides for command-line
Ready to take control of your computer with text commands? Our CLI tutorials offer step-by-step guides for hands-on learning. Start today!
Validating K8s configuration files to prevent misconfiguration
Delve into the significance of validating Kubernetes configuration files to avoid common pitfalls and explore our practical demonstration of how to do all this using Civo's managed Kubernetes service.