Truefoundry Onboarding CLI

The Onboarding CLI is a powerful command-line tool designed to streamline the process of deploying kubernetes services, be it Amazon Elastic Kubernetes Service (EKS), Azure kubernetes service (AKS) and Google kubernetes engine (GKE), along with their essential requirements. By asking a few crucial inputs from the user, the CLI configures the necessary infrastructure, easing the burden of cluster creation and management.

Understanding the use of OCLI

TrueFoundry uses code to spin up the infrastructure and hence uses Terraform and Terragrunt to create the infrastructure. Onboarding CLI is just a thin wrapper around the TrueFoundry terraform modules.

Just like terraform ask users for input OCLI brings the same functionality in your local linux terminal with more interactivity and focus on Kubernetes cluster and its requirements.

Core concepts

Below are the core concepts of OCLI

Config file

Everything in ocli revolves around your config file. This config file is a YAML based user input which is generated when the command ocli infra init is executed. Terraform module takes the input from this file before bootstrapping the infrastructure.

Terragrunt

To run the terraform modules in order and make them more DRY in nature, terragrunt is used alongside terraform. When you run the ocli to bootstrap your infrastructure a terragrunt code will be shipped on your local with all the inputs and the possible modifications. For better updates and reliability of your infrastructure we recommend users to keep this terragrunt code saved in your Version control. Periodic updates in our terraform modules can then be easily applied in the cluster.

Connecting infra

Apart from bringing the Kubernetes cluster in the cloud, OCLI makes sure to install all the rightful components inside the cluster along with the truefoundry-agent which is responsible for [connecting the cluster to the control plane].

Installing

  1. Download the binary using the below command.
    curl -H 'Cache-Control: max-age=0' -s https://releases.ocli.truefoundry.tech/binaries/ocli_$(curl -H 'Cache-Control: max-age=0' -s https://releases.ocli.truefoundry.tech/stable.txt)_darwin_arm64 -o ocli
    
    curl -H 'Cache-Control: max-age=0' -s https://releases.ocli.truefoundry.tech/binaries/ocli_$(curl -H 'Cache-Control: max-age=0' -s https://releases.ocli.truefoundry.tech/stable.txt)_darwin_amd64 -o ocli
    
    curl -H 'Cache-Control: max-age=0' -s https://releases.ocli.truefoundry.tech/binaries/ocli_$(curl -H 'Cache-Control: max-age=0' -s https://releases.ocli.truefoundry.tech/stable.txt)_linux_arm64 -o ocli
    
    curl -H 'Cache-Control: max-age=0' -s https://releases.ocli.truefoundry.tech/binaries/ocli_$(curl -H 'Cache-Control: max-age=0' -s https://releases.ocli.truefoundry.tech/stable.txt)_linux_amd64 -o ocli
    
  2. Make the binary executable and move it to $PATH
    sudo chmod +x ./ocli
    sudo mv ocli /usr/local/bin
    
  3. Confirm by running the command
    ocli --version
    

📘

Update to ocli latest version

Always make sure to update ocli to the latest version.

OCLI steps

  1. Creating a config file - First step is to create a config. This step will create a file in your current directory with the name tfy-config.yaml
    ocli infra init
    
  2. During the init step you will be asked for few inputs related to your account in AWS, project for GCP and subscription for Azure. You can always use up and down arrow key to select from the dropdown and you can press forward slash and do a toggle keyword search to filter a long list.
  3. Running the config file - This steps configures your infrastructure with the specified config file
    ocli infra create --file tfy-config.yaml
    
  4. Saving the output file - This step saves the output of the terraform module
    ocli infra output --file tfy-config.yaml
    
  5. Connecting your infrastructure - This steps connect your infrastructure to the control plane. This command is available when you try to setup your cluster from the UI. This installs the agent in your kubernetes cluster.
    ocli infra connect --file tfy-config.yaml --cloud CLOUD_TYPE \
    --control-plane-url CONTROL_PLANE_URL \
    --token TOKEN  --tenant TENANT