AWS EKS Deployment

❗️

This is a legacy Apache Ignite documentation

The new documentation is hosted here: https://ignite.apache.org/docs/latest/

Amazon Web Services EKS Deployment

NOTE: You must follow the Amazon Elastic Container Service for Kubernetes (Amazon EKS) Getting Started procedures:

In this documentation, we're going to use the AWS EKS Console and AWS CLI for the EKS deployment. We will also use the EU (Ireland) (eu-west-1) region. A Key Pair is also required and it is good to have this ready for use later. You can use AWS EC2 to create this Key Pair.

Amazon EKS Prerequisites

Once you've created an AWS account, follow all of the steps listed in Getting Started with Amazon EKS:

  • Create your Amazon EKS Service Role
  • Create your Amazon EKS Cluster VPC
  • Install and Configure kubectl for Amazon EKS
  • Download and Install the Latest AWS CLI

Create Your Amazon EKS Cluster

Use the AWS CLI to create your cluster, using the following format:

aws eks create-cluster --name ignitecluster --role-arn arn:aws:iam::111122223333:role/eks-service-role --resources-vpc-config subnetIds=subnet-a9189fe2,subnet-50432629,securityGroupIds=sg-f5c54184

Substitute the values for:

  • --name
  • --role-arn
  • --resources-vpc-config (subnetIds and securityGroupIds)

In the example above, ignitecluster is the name of the Kubernetes cluster.

Check the status of cluster creation using the following command:

aws eks describe-cluster --name ignitecluster --query cluster.status

Proceed to the next step when the cluster status is ACTIVE.

Configure kubectl for Amazon EKS

Create a kubeconfig file with the AWS CLI, as follows:

aws eks update-kubeconfig --name ignitecluster

You can test the configuration as follows:

kubectl get svc

The output should be similar to the following:

NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.100.0.1   <none>        443/TCP   12m

Launch and Configure Amazon EKS Worker Nodes

Follow the step-by-step guidelines in the Getting Started with Amazon EKS.

Launch worker nodes

Follow the instructions in the Amazon guide to create the stack. The following example uses ignitecluster:

2006

Here, the defaults are used for most of the parameters and the remaining values are based upon previous configuration steps:

2009

Once the stack is created, you need to save the value of the NodeInstanceRole, which is used in the next step.

Enable worker nodes to join the cluster

First, you need to download the configuration map file, as follows:

curl -O https://amazon-eks.s3-us-west-2.amazonaws.com/cloudformation/2018-08-30/aws-auth-cm.yaml

Next, in the map file, replace <ARN of instance role (not instance profile)> with the value of the NodeInstanceRole you saved in the previous step. Then, run the following command:

kubectl apply -f aws-auth-cm.yaml

Next, check that all the nodes are in the Ready state with this command:

kubectl get nodes

The output might be as follows:

NAME                                            STATUS    ROLES    AGE       VERSION
ip-192-168-155-238.eu-west-1.compute.internal   Ready     <none>    2m        v1.10.3
ip-192-168-205-7.eu-west-1.compute.internal     Ready     <none>    2m        v1.10.3
ip-192-168-90-214.eu-west-1.compute.internal    Ready     <none>    2m        v1.10.3

Ignite Cluster Deployment

To deploy Ignite cluster within Amazon EKS you need to perform at least three steps:

  • Set up RBAC authorization.
  • Deploy Ignite Service that is used for Ignite nodes auto-discovery within Kubernetes and that is also used as a LoadBalancer for your external applications.
  • Deploy Ignite cluster as a stateless or stateful solution.

All the yaml files required to perform these steps are provided for you on GitHub. Download these files to your AWS CLI shell.

RBAC Authorization

First, you need RBAC Authorization to create an Ignite-specific namespace, service account, and role. Run the following commands, in order, one-by-one:

kubectl create -f ignite-namespace.yaml
kubectl create -f ignite-service-account.yaml
kubectl create -f ignite-account-role.yaml
kubectl create -f ignite-role-binding.yaml

Refer to the RBAC Authorization guide for further details.

Finally, switch the current namespace for your AWS CLI connection by running the following command:

kubectl config set-context $(kubectl config current-context) --namespace=ignite

Ignite Service Deployment

Deploy a special Ignite service that is used for Ignite nodes auto-discovery and as a LoadBalancer for external applications. Run the following command:

kubectl create -f ignite-service.yaml

Refer to the Ignite Service guide for further details.

Check that the service is deployed by using the following command:

kubectl get svc ignite

Ignite Stateless Deployment

Ignite Stateless deployment can be used to deploy Ignite as a memory-centric database without Ignite persistence. Run the following command:

kubectl create -f ignite-deployment.yaml

Refer to the Stateless Deployment guide for further details.

Ignite StatefulSet Deployment

Ignite Statefulset deployment can be used to deploy Ignite as a memory-centric database with Ignite persistence enabled. Two options are available depending upon where you wish to store the Write Ahead Log (WAL):

  1. Separate Disk for WAL (recommended)
  2. Same storage for the database and WAL files

Separate Disk for WAL

Run the following commands, in order, one-by-one:

kubectl create -f ignite-wal-storage-class.yaml
kubectl create -f ignite-persistence-storage-class.yaml
kubectl create -f ignite-stateful-set.yaml

Same storage for the database and WAL files

Refer to the Stateful Deployment guide for further details.

You can check that the pods are deployed using the following command:

kubectl get pods

Once the pods are deployed try to scale out your Ignite deployment by running the following command:

kubectl scale sts ignite --replicas=4

Ignite Cluster Activation

Since we're using Ignite native persistence for our deployment we need to activate the Ignite cluster after it's started. To do that, connect to one of the pods:

kubectl exec -it ignite-0 --namespace=ignite -- /bin/bash

Go to the following folder:

cd /opt/ignite/apache-ignite-fabric/bin/

And activate the cluster by running the following command:

./control.sh --activate

Connecting from External Applications

Let's connect to our Ignite cluster from an external application (the one that's not deployed in Kubernetes). We're going to use JDBC driver to work with Ignite using SQL interface.

First, find out what's the external address of the Ignite service. For instance, you can do that by using the command:

kubectl describe svc ignite

Note the address of the LoadBalancer.

Next, download an Ignite release, go to {ignite_release}/bin and use the following command to connect to the cluster with SQLLine tool:

./sqlline.sh --verbose=true -u jdbc:ignite:thin://{EXTERNAL_IP}:10800

Once connected, preload the World Database delivered with every Ignite release by running this command from SQLLine:

!run ../examples/sql/world.sql

After that, feel free to interact with your deployment by running SQL queries as follows:

SELECT country.name, city.name, MAX(city.population) as max_pop FROM country
    JOIN city ON city.countrycode = country.code
    WHERE country.code IN ('USA','RUS','CHN')
    GROUP BY country.name, city.name ORDER BY max_pop DESC LIMIT 3;

Installing Web Console

If you want to install Web Console in Kubernetes, please refer to the installation instructions.