Sections below illustrate how to setup and deploy Fiorano API servers in a Kubernetes cluster on a local system using Minikube:
- Installing Virtual Box
- Installing Minikube (for Debian-based Linux)
- Setting up a Kubernetes cluster
- Set up a Network File System for persisting data
- Start Minikube
- Minikube file setup
- Transfer the .tar files saved from docker
- Load the docker images
- Load the cassandra, postgres, AMS and AGS images
- Enable port-forwarding in the minikube
- Restart the minikube with existing configurations
- Execute the yaml files in the order mentioned below
- Scaling
Installing Virtual Box
Download and Install the virtual box from https://www.virtualbox.org/wiki/Downloads
Installing Minikube (for Debian-based Linux)
Install and setup kubectl
Install Minikube
Start Minikube and check
Setting up a Kubernetes cluster
Set up a Network File System for persisting data
- Install nfs-server in the host machine and nfs-client in the client machine to access the files.
To link a host directory to mount point, edit /etc/fstab and then give the command below:
- To mount a directory, edit /etc/exports and set the directory.
Use the command below to export all directories mentioned in the /etc/exports:
Check if it is mounted successfully using the command below:
Start Minikube
For Windows 10 Professional Edition
- Install Chocolatey package manager for ease.
- Enable Hyper-V from Windows Features
Using chocolatey, install kubernetes-cli using the command:
Using chocolatey, install minikube using the command:
- To set where the VM needs to be created, add MINIKUBE_HOME=<pathofVMdir> to system properties.
- After it creates VM in the path, configure Hyper-V Switch Manager to allow internet access for the VM.
Start minikube vm using the command:
For Debian based Linux
Start minikube and set up resources as per requirement
Open dashboard using the command:
Minikube file setup
Ssh into the VM
Set user permissions in the data folder in minikube
Also note the <VM_IP> of the minikube node
Transfer the .tar files saved from docker
The tar file can be copied using scp command
Load the docker images
Load the cassandra, postgres, AMS and AGS images
Enable port-forwarding in the minikube
Create a script with contents as below and execute the script to open port forwarding:
Restart the minikube with existing configurations
Execute the yaml files in the order mentioned below
services.yaml file contains the ports required to be exposed by the node for AMS servers and database while also taking care of directing requests. It is of type NodePort and has cluster IP 10.96.0.20
ags-services.yaml contains the ports for accessing resource created by a project. It is of type LoadBalancer and has cluster IP 10.96.0.30
Set the login credentials for postgres comprising of username, password in postgres-config.yaml
Create persistent volumes and their respective claims for Cassandra, Postgres and Fiorano AMS runtimedata.
Create deployment for multicontainer pods containing Fiorano AMS and databases.
Wait for 5 minutes to get all the containers running and the workloads to turn green from yellow which means deployments are successful.
Check if deployment successful by opening the apimgmt dashboard in the browser.
Common causes of deployment failure:- Fiorano Installer License Expiry
- Unable to link to the persistent volume which may be due to unavailability of NFS-server
- Ensure that the docker image is loaded in minikube ssh and the docker image name correctly corresponds in the yaml file.
Create a stateful set for AGS servers. ( Ensure port forwarding has been enabled in VM before this step)
Login to the API management dashboard and check for the servers ags_0 etc. available in the server group - serverGroup1.
Deploy projects and check the accessibility of the resource hosted by the gateway servers by changing the IP to localhost:2160
Scaling
Manual Scaling
Change the number of replicas manually by clicking "Edit" option in stateful sets in dashboard.
Autoscaling
For auto-scaling add resource request and limit value in AGS stateful sets.
Now stop minikube in current configuration
- Start minikube with the following arguments.
For Debian based Linux:
For Windows:
Enable the metrics-server add on using the following command:
Then wait for some time and create the autoscaler
For system details:For container details:For the above-mentioned autoscaler details:For memory-based autoscaling, create a yaml file with the content below and set targetAverageUtilization in it as per requirement:
To deploy this autoscaler use the command below:
Use kubectl describe hpa to see what its doing
To delete hpa, use: