Deploy Trellis Enterprise on Kubernetes Cluster

Deploying Trellis Enterprise using Kubernetes

System Requirements

Software and Hardware

  • Minimum Kubernetes v1.29+
  • Minimum Machine Requirements
    • Hard Disk: At least 256 GB
    • Master Node:
      • Count: 1; RAM: At least 16 GB; vCores: 2
    • Worker Node:
      • Count: 4; RAM: At least 16 GB, vCore: 1
    • Operating System: Linux (Ubuntu, RedHat, Fedora, Debian or OpenSuse), MacOS 13.x+ or Windows 10.x+
    • Software Installed
      • Python 3.9.x+
      • If Windows, then Docker Desktop with Kubernetes running in Cluster Mode.
      • If Linux or MacOS, then native Docker and Kubernetes libraries.
        • ZSH or BASH enabled
        • Homebrew (optional)
  • Minimum Pods Required: 4
  • Internet Connectivity

Package Verifications

Kubernetes

Verify the Kubernetes installation by running the below command

kubectl --verion

The output should be something like below:

Client Version: v1.30.0
Kustomize Version: v4.4.2
Server Version: v1.30.3-eks-2f46c53

Python

Verify the Python installation by running the below command

python --verion

The output should be like below:

Python 3.11.2

Installing pip locally

python -m ensurepip --upgrade

Alternatively, you can also run the below command to install pip

python get-pip.py


NOTE  If any of the above steps fail, please do not proceed to the next steps. Contact your Trellis account representative for assistance with verifying your environment.


Deployment

Connect to your Cloud Provider

If you would like us to also connect to your private cloud such as AWS, Azure, or GCP, then add the below in the root directory and save the file as .trellis_envin your user's root directory.

[default]
cloud=AWS
deployment=kubernetes-cluster
AWS_ACCESS_KEY=abcdefgh123456  
AWS_SECRET_ACCESS_KEY=abcdefghijklmnopqrstuvwxyz

If you are using Azure or GCP, then the value of cloud will be azure or gcp respectively.

Connect to your Kubernetes Cluster

If you have already connected to your remote Kubernetes cluster, please skip this section and proceed to the next steps.

Run the below command to establish context with your remote cluster.

# replace my-remote-cluster in the below command with your actual cluster name
# add the ip address and the port of your master node in the below command
kubectl config set-cluster my-remote-cluster --server=http://<master-ip>:<port> --api-version=v1

# use context set in the previous step.
kubectl config use-context my-remote-cluster

Installation

You'll need your enterprise license key, which your Trellis Account representative will share separately.

Download the Trellis Enterprise Python package and run the commands below individually.

# Create a directory for your trellis installation
mkdir -p trellis-enterprise

# Set up the virtual environment
python -m venv .trellis-venv-enterprise

# Activate the virtual environment
source .trellis-venv-enterprise/bin/activate

# Install the trellis python libraries
pip install trellis-enterprise

# Set up the enterprise license key in your environment.
# This will be shared with you by your Trellis Account representative.
export TRELLIS_ENTERPRISE_LICENSE_KEY=ABCDE-12345-PQRST-67890-JKLMN

Trellis Logs

All the application logs are saved to the directory where the installer was run. In the above, it will be trellis-enterprise

  • If you wish to transfer the logs to another storage, such as AWS - S3, please set up the file .trellis_envin your user's root directory with below. The AWS_ACCESS_KEY and AWS_SECRET_ACCESS_KEY will be the access keys with the permission to push the logs to the S3 directory. The logs will be sent directly from the worker nodes within the cluster.
[default]  
cloud=AWS
logs_path=s3://my_s3_directory
deployment=kubernetes-cluster
AWS_ACCESS_KEY=abcdefgh123456  
AWS_SECRET_ACCESS_KEY=abcdefghijklmnopqrstuvwxyz

Windows Only Deployment

If you use Windows, open your preferred editor and copy/paste the script below.

import os
import platform
import subprocess
import urllib.request
import trellis-enterprise

def install_trellis():
    try:
        # Download Trellis installer
        url = f'https://download.runtrellis.com/?product=trellis-enterprise-win&lang=en-US'
        installer_path = 'trellis_enterprise.exe'
        urllib.request.urlretrieve(url, installer_path)

        # Install Trellis-Enterprise silently
        subprocess.check_call([installer_path, '-ms'])
        
        # Delete the installer file
        os.remove(installer_path)
        
        print(f"Successfully installed 'trellis-enterprise'")
    except subprocess.CalledProcessError:
        print(f"Failed to installed 'trellis-enterprise'")
        

Save the above script as download_trellis.py and then run the below command to execute it

python download_trellis.py

The above command will download the packages and install Trellis on your Kubernetes cluster. If you are not running as an administrator, you will be prompted to enter the admin password to approve the package access.

Non-Windows Only Deployment

The steps below are only for non-Windows operating systems. If you have a Windows environment, use the preceding section for Windows-only deployment.

import os
import platform
import subprocess
import zipfile
import shutil
import tarfile
import urllib.request
import trellis-enterprise

def install_trellis():
    try:
        # Download Trellis installer
        url = f'https://download.runtrellis.com/?product=trellis-enterprise-non-win&lang=en-US'
        installer_path = 'trellis_enterprise.zip'
        urllib.request.urlretrieve(url, installer_path)

        # Install Trellis-Enterprise silently
        if installer_path.endswith('.zip'):
        	opener, mode = zipfile.ZipFile, 'r'
    		elif installer_path.endswith('.tar.gz') or installer_path.endswith('.tgz'):
        	opener, mode = tarfile.open, 'r:gz'
         
        file = opener(installer_path, mode)
        file.extractall("trellis_enterprise_pckgs")
                
        # Delete the installer file
        os.remove(installer_path)
        
        print(f"Successfully downloaded 'trellis-enterprise'")
    except subprocess.CalledProcessError:
        print(f"Failed to downloaded 'trellis-enterprise'")
        

Save the above script as download_trellis.py and then run the below command to execute it

# To run the script as admin and avoid being prompted for passwords.
# If you don't want to run as admin, then just run the below command without the sudo in the beginning.
sudo python download_trellis.py

The above command will download the packages and install Trellis on your Kubernetes cluster. If you are not running as an administrator, you will be prompted to enter the admin password to approve the package access.

Verify Deployment

If the installation works, you will receive a Success pop-up message. At the command prompt, you can run the below command to verify your Trellis environment.

trellis status

The output should confirm the status and display the expiration date based on your enterprise contract.

###############################################################################
  Trellis Environment Status
  
  Plan: Enterprise
  Expires On: Jan 01, 2020

  -------------------------------------------------------
	    Deployment Type: Kubernetes Cluster
  -------------------------------------------------------
  Master Node: 1 
		- Cluster IP: x.x.x.x:yyyy
  Worker Node(s): 4
		- Worker 1: IP: a.a.a.a:abcd
		- Worker 2: IP: b.b.b.b:efgh
		- Worker 3: IP: c.c.c.c:pqrst
		- Worker 4: IP: d.d.d.d:mnop
###############################################################################

NOTE  If any of the above steps fail, please do not proceed to the next steps. Contact your Trellis account representative for assistance with verifying your environment.



What’s Next

Go Serverless with Trellis Enterprise