Contents

Popular

Sections below illustrate how to setup and deploy Fiorano API servers in a Kubernetes cluster on a local system using Minikube:

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

Sample of of Kubectl configuration status

Icon

Starting local Kubernetes v1.10.0 cluster...
Starting VM...

Downloading Minikube ISO
171.87 MB / 171.87 MB [============================================] 100.00% 0s
Getting VM IP address...
Moving files into cluster...
Downloading kubeadm v1.10.0
Downloading kubelet v1.10.0
Finished Downloading kubelet v1.10.0
Finished Downloading kubeadm v1.10.0
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.

Minikube

Icon
  • Command to ssh into the VM
  • Command to stop
  • Command to delete VM

Setting up a Kubernetes cluster

Set up a Network File System for persisting data 

  1. Install nfs-server in the host machine and nfs-client in the client machine to access the files.
  2. To link a host directory to mount point, edit /etc/fstab and then give the command below:

  3. To mount a directory, edit /etc/exports and set the directory.
  4. Use the command below to export all directories mentioned in the /etc/exports:

  5. Check if it is mounted successfully using the command below:

Start Minikube

  • For Windows 10 Professional Edition

    1. Install Chocolatey package manager for ease.
    2. Enable Hyper-V from Windows Features
    3. Using chocolatey, install kubernetes-cli using the command:

    4. Using chocolatey, install minikube using the command:

    5. To set where the VM needs to be created, add MINIKUBE_HOME=<pathofVMdir> to system properties.
    6. After it creates VM in the path, configure Hyper-V Switch Manager to allow internet access for the VM.
    7. Start minikube vm using the command:

  • For Debian based Linux

    1. Start minikube and set up resources as per requirement 

    2. Open dashboard using the command:

Minikube file setup 

  1. Ssh into the VM

  2. Set user permissions in the data folder in minikube

  3. 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

Example


Load the docker images  

Usage

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:

VBoxManage modifyvm "minikube" --natpf1 "cassandra,tcp,,9042,,31042"
VBoxManage modifyvm "minikube" --natpf1 "peer,tcp,,1880,,31880"
VBoxManage modifyvm "minikube" --natpf1 "postgres,tcp,,5432,,31432"
VBoxManage modifyvm "minikube" --natpf1 "server,tcp,,2147,,32147"
VBoxManage modifyvm "minikube" --natpf1 "soa dashboard,tcp,,1980,,31980"
VBoxManage modifyvm "minikube" --natpf1 "tls-intra,tcp,,7001,,31001"
VBoxManage modifyvm "minikube" --natpf1 "jmx,tcp,,7199,,31099"
VBoxManage modifyvm "minikube" --natpf1 "intra-node,tcp,,7000,,31000"
VBoxManage modifyvm "minikube" --natpf1 "https,tcp,,14401,,443"
VBoxManage modifyvm "minikube" --natpf1 "http,tcp,,14400,,80"
VBoxManage modifyvm "minikube" --natpf1 "backup,tcp,,2148,,32148"
VBoxManage modifyvm "minikube" --natpf1 "apimgmt,tcp,,1981,,31981"
VBoxManage modifyvm "minikube" --natpf1 "resources,tcp,,2160,,32160"
VBoxManage modifyvm "minikube" --natpf1 "rmi,tcp,,2367,,32367"
VBoxManage modifyvm "minikube" --natpf1 "conn,tcp,,2167,,32167" 

Restart the minikube with existing configurations  

Execute the yaml files in the order mentioned below

  1. 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

  2. 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

    Icon

    Ensure that the service name in yaml corresponds to the app name of the deployment or stateful set to be created; otherwise it may not work properly.

  3. Set the login credentials for postgres comprising of username, password in postgres-config.yaml

  4.  Create persistent volumes and their respective claims for Cassandra, Postgres and Fiorano AMS runtimedata.


  5. 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:

    1. Fiorano Installer License Expiry
    2. Unable to link to the persistent volume which may be due to unavailability of NFS-server
    3. Ensure that the docker image is loaded in minikube ssh and the docker image name correctly corresponds in the yaml file.
  6. 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  

Icon

This would work provided 2160 has been port forwarded in VM and the ags-service is deployed

Scaling

Manual Scaling

Change the number of replicas manually by clicking "Edit" option in stateful sets in dashboard.

Autoscaling

  1. For auto-scaling add resource request and limit value in AGS stateful sets.



  2. Now stop minikube in current configuration 

  3. Start minikube with the following arguments.
    1. For Debian based Linux:

    2. For Windows: 



  4. Enable the metrics-server add on using the following command:

  5. Then wait for some time and create the autoscaler

    For system details:
    For container details:
    For the above-mentioned autoscaler details:



  6. For memory-based autoscaling, create a yaml file with the content below and set targetAverageUtilization in it as per requirement:

  7. To deploy this autoscaler use the command below:



  8. Use kubectl describe hpa to see what its doing

     
    To delete hpa, use:

    Icon

    This would work provided 2160 has been port forwarded in VM and the ags-service is deployed

Adaptavist ThemeBuilder EngineAtlassian Confluence