This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Kubernetes Cluster

Install OpenServerless in a Kubernetes cluster

Prerequisites to install OpenServerless in a Kubernetes cluster

You can install OpenServerless in any Kubernetes cluster which satisfy some requirements.

Kubernetes clusters are available pre-built from a variety of cloud providers. We provide with our ops tool the commands to install a Kubernetes cluster ready for OpenServerless in the following environments:

You can also provision a suitable cluster by yourself, in any cloud or on premises, ensuring the prerequites are satisfied.

Once provisioned, you will receive a configuration file to access the cluster, called kubeconfig.

This file should be placed in ~/.kube/config to give access to the cluster

If you have this file, you can check if you have access to the cluster with the command:

ops debug kube info

You should see something like this:

Kubernetes control plane is running at https://xxxxxx.yyy.us-east-1.eks.amazonaws.com

Once you have got access to the Kubernetes cluster, either installing one with out commands or provisioning one by yourself, you can proceed configuring the installation and then installing OpenServerless in the cluster.

1 - Amazon EKS

Prerequisites for Amazon EKS

Prerequisites to install OpenServerless in an Amazon EKS Cluster

Amazon EKS is a pre-built Kubernetes cluster offered by the cloud provider Amazon Web Services.

You can create an EKS Cluster in Amazon AWS for installing using OpenServerless using ops as follows:

  1. install aws, the AWS CLI

  2. get Access and Secret Key

  3. configure EKS

  4. provision EKS

  5. optionally, retrieve the load balancer address to configure a DNS name

Once you have EKS up and running you can proceed configuring and installing OpenServerless.

Installing the AWS CLI

Our cli ops uses under the hood the AWS CLI version 2, so you need to dowload and install it following those instructions.

Once installed, ensure it is available on the terminal executing the following command:

aws --version

you should receive something like this:

aws-cli/2.9.4 Python/3.9.11 Linux/5.19.0-1025-aws exe/x86_64.ubuntu.22 prompt/off

Ensure the version is at least 2.

Getting the Access and Secret key

Next step is to retrieve credentials, in the form of an access key and a secret key.

So you need to: * access the AWS console following those instructions create an access key and secret key, * give to the credentials the minimum required permissions as described here to build an EKS cluster.

You will end up with a couple of string as follows:

Sample AWS Access Key ID: AKIAIOSFODNN7EXAMPLE Sample AWS Secret Access
Key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

Take note of them as you need them for configuring out CLI.

Configuring Amazon EKS

Once you have the access and secret key you can configure EKS with the command ops config eks answering to all the questions, as in the following example:

$ ops config eks
*** Please, specify AWS Access Id and press enter.
AKIAIOSFODNN7EXAMPLE
*** Please, specify AWS Secret Key and press enter.
wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
*** Please, specify AWS Region to use and press enter.
To get a list of valid values use:
  aws ec2 describe-regions --output table

Just press enter for default [us-east-2]:

*** Please, specify AWS public SSH key  and press enter.
If you already have a public SSH key in AWS, provide its name here.
If you do not have it, generate a key pair with the following command:
  ssh-keygen
The public key defaults to ~/.ssh/id_rsa.pub and you can import with:
  aws ec2 import-key-pair --key-name nuvolaris-key --public-key-material --region=<your-region> fileb://~/.ssh/id_rsa.pub

Just press enter for default [nuvolaris-key]:

*** Please, specify EKS Name for Cluster and Node Group and press enter.
Just press enter for default [nuvolaris]:

*** Please, specify EKS region and press enter.
To get a list of valid values use:
  aws ec2 describe-regions --output table

Just press enter for default [us-east-1]:

*** Please, specify EKS number of worker nodes and press enter.
Just press enter for default [3]:

*** Please, specify EKS virtual machine type and press enter.
To get a list of valid values, use:
  aws ec2 describe-instance-types --query 'InstanceTypes[].InstanceType' --output table

Just press enter for default [m5.xlarge]:

*** Please, specify EKS disk size in gigabyte and press enter.
Just press enter for default [50]:

*** Please, specify EKS Kubernetes Version and press enter.
Just press enter for default [1.25]:

Provisioning Amazon EKS

Once you have configured it, you can create the EKS cluster with the command:

ops cloud eks create

It will take around 20 minutes to be ready. Please be patient.

At the end of the process, you will have access directly to the created Kubernetes cluster for installation.

Retrieving the Load Balancer DNS name

Once the cluster is up and running, you need to retrieve the DNS name of the load balancer.

You can read this with the command:

ops cloud eks lb

Take note of the result as it is required for configuring a dns name for your cluster.

Additional Commands

You can delete the created cluster with: ops cloud eks delete

You can extract again the cluster configuration, if you lose it, reconfiguring the cluster and then using the command ops cloud eks kubeconfig.

2 - Azure AKS

Prerequisites for Azure AKS

Prerequisites to install OpenServerless in an Azure AKS Cluster

Azure AKS is a pre-built Kubernetes cluster offered by the cloud provider Microsoft Azure.

You can create an AKS Cluster in Microsoft Azure for installing using OpenServerless using ops as follows:

  1. install az, the Azure CLI

  2. configure AKS

  3. provision AKS

  4. optionally, retrieve the load balancer address to configure a DNS name

Once you have AKS up and running you can proceed configuring and installing OpenServerless.

Installing the Azure CLI

Our CLI ops uses under the hood the Azure CLI, so you need to dowload and install it following those instructions.

Once installed, ensure it is available on the terminal executing the following command:

az version

you should receive something like this:

{
  "azure-cli": "2.51.0",
  "azure-cli-core": "2.51.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {}
}

Configuring Azure AKS

Before provisioning your AKS cluster you need to configure AKS with the command ops config aks answering to all the questions, as in the following example:

$ ops config aks
*** Please, specify AKS Name for Cluster and Resource Group and press enter.
Just press enter for default [nuvolaris]:

*** Please, specify AKS number of worker nodes and press enter.
Just press enter for default [3]:

*** Please, specify AKS location and press enter.
To get a list of valid values use:
  az account list-locations -o table

Just press enter for default [eastus]:

*** Please, specify AKS virtual machine type and press enter.
To get a list of valid values use:
  az vm list-sizes --location <location> -o table
where <location> is your current location.

Just press enter for default [Standard_B4ms]:

*** Please, specify AKS disk size in gigabyte and press enter.
Just press enter for default [50]:

*** Please, specify AKS public SSH key in AWS and press enter.
If you already have a public SSH key provide its path here. If you do not have it, generate a key pair with the following command:
  ssh-keygen
The public key defaults to ~/.ssh/id_rsa.pub.

Just press enter for default [~/.ssh/id_rsa.pub]:

Provisioning Azure AKS

Once you have configured it, you can create the AKS cluster with the command:

ops cloud aks create

It will take around 10 minutes to be ready. Please be patient.

At the end of the process, you will have access directly to the created Kubernetes cluster for installation.

Retrieving the Load Balancer DNS name

Once the cluster is up and running, you need to retrieve the DNS name of the load balancer.

You can read this with the command:

ops cloud aks lb

Take note of the result as it is required for configuring a dns name for your cluster.

Additional Commands

You can delete the created cluster with: ops cloud aks delete

You can extract again the cluster configuration, if you lose it, reconfiguring the cluster and then using the command nuv cloud aks kubeconfig.

3 - Generic Kubernetes

Prerequisites for all Kubernetes

Kubernetes Cluster requirements

OpenServerless installs in any Kubernetes cluster which satisfies the following requirements:

  • cluster-admin access

  • at least 3 worker nodes with 4GB of memory each

  • support for block storage configured as default storage class

  • support for LoadBalancer services

  • the nginx ingress already installed

  • the cert manager already installed

Once you have such a cluster, you need to retrieve the IP address of the Load Balancer associated with the Nginx Ingress. In the default installation, it is installed in the namespace nginx-ingress and it is called ingress-nginx-controller.

In the default installation you can read the IP address with the following command:

kubectl -n ingress-nginx get svc ingress-nginx-controller

If you have installed it in some other namespace or with another name, change the command accordingly.

The result should be something like this:

NAME                       TYPE           CLUSTER-IP   EXTERNAL-IP    PORT(S)                      AGE
ingress-nginx-controller   LoadBalancer   10.0.9.99    20.62.156.19   80:30898/TCP,443:31451/TCP   4d1h

Take note of the value under EXTERNAL-IP as you need it in the next step of installation, configuring DNS.