User Tools

Site Tools


development:deploying:prod_deployments:civo_environment_setup

Civo Environment Setup

Civo CLI

Civo has their own cli tool that can be used to interact with their hosting products. You can install it by running the following (macOS):

brew tap civo/tools
brew install civo

You need to obtain your api key from the civo dashboard:

Once you have your api key in hand, you can connect the civo cli with the following steps:

  1. Run the following command:
    civo apikey save
  2. When prompted to “Enter a nice name for this account/API Key”, enter:
    cultivate-finance
  3. When prompted to “Enter the API key”, enter the your Civo API key obtained from previous steps.

Once your API key is set, you can run civo commands to interact with your cluster.

Creating a new cluster

We can use the following command to create a new kubernetes cluster:

set -k 
 
# delete cluster if exists
civo kubernetes delete cultivate-finance
 
# create the new cluster
civo kubernetes create cultivate-finance -n 1 -s g4s.kube.medium --cluster-type k3s --create-firewall --firewall-rules "6443" --region NYC1 --wait --save --merge --switch --create-firewall --firewall-rules '80;443;6443'

You can download your civo kubernetes cluster config with the following command:

civo kubernetes config cultivate-finance --save

Confirm you can see stats from your civo kubernetes cluster with the following command:

civo kubernetes show cultivate-finance

Setting up the network to your cluster

  1. Obtain the DNS Record for the cluster by running the following command:
    civo kubernetes show cultivate-finance -o custom -f "DNSEntry"
  2. Under the CIVO web panel, navigate to Networking → DNS
  3. Under cultivatefinance.org, click Actions → DNS Records
  4. Click Add Record
  5. Select CNAME
  6. Under Name use cultivatefinance.org
  7. Under Value use the DNS record given from step 2
  8. Set TTL to 3600
  9. Click Add Record
  10. Select CNAME
  11. Under Name use www.cultivatefinance.org
  12. Under Value use the DNS record given from step 2
  13. Set TTL to 3600

Install the necessary applications to the cluster

We use Kubernetes Dashboard for monitoring and Cert Manager for managing our TLS certificates. You can install both of them by running the following:

civo kubernetes applications add kubernetes-dashboard --cluster cultivate-finance
civo kubernetes applications add cert-manager --cluster cultivate-finance

Monitoring with Kubernetes Dashboard

Generate an admin user token by running the following:

kubectl -n kubernetes-dashboard create token admin-user

Once you have your token, you can proxy into the control plane with the following command:

kubectl proxy

Then browse the dashboard at:

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login

development/deploying/prod_deployments/civo_environment_setup.txt · Last modified: 2024/06/06 16:41 by 127.0.0.1