Deploy Aerospike Graph Service with Kubernetes
This page describes how to run Aerospike Graph Service (AGS) using Kubernetes and connect to an Aerospike Database cluster.
Aerospike Database requirements
- A running Aerospike Database deployment, version 7.0 or later.
- If access control is enabled on the Aerospike Database, AGS must have
sys-adminandread-writeprivileges as a database user. - Verify the namespace AGS uses on your Aerospike Database server has the configuration option default-ttl set to 0. See the TTL configuration instructions for setting this option after the server has started.
- If TLS is required between AGS and the Aerospike Database, enable it and provide the TLS name and port via Helm parameters. See TLS between AGS and Aerospike DB for configuration details.
Deploy AGS on Kubernetes
Select a deployment platform from the following tabs.
Deploying locally requires minikube, kubectl, and Helm.
Deploy AGS on minikube
-
Start a Kubernetes cluster locally using minikube:
Terminal window minikube start -
Deploy Aerospike Database on minikube.
See Install the Aerospike Kubernetes Operator to install AKO using Helm, then go to Deploy Aerospike with Helm to deploy Aerospike on the cluster.
-
Verify you are pointing to the right Kubernetes context:
Terminal window kubectl config get-contextsThe current context should point to your minikube cluster.
Deploying on EKS requires eksctl, kubectl, and Helm.
Deploy AGS on EKS
-
Provision an EKS cluster.
Create an EKS cluster in the same region and availability zone as your Aerospike Database. Replace the placeholder values with your AWS configuration:
ags-eks-cluster.yaml apiVersion: eksctl.io/v1alpha5kind: ClusterConfigmetadata:name: ags-eks-clusterregion: YOUR_REGIONvpc:id: YOUR_VPC_IDsubnets:public:YOUR_AVAILABILITY_ZONE_A:id: YOUR_SUBNET_ID_AYOUR_AVAILABILITY_ZONE_B:id: YOUR_SUBNET_ID_BYOUR_AVAILABILITY_ZONE_C:id: YOUR_SUBNET_ID_Ciam:withOIDC: truemanagedNodeGroups:- name: ng-ags-testinstanceType: m5d.2xlargedesiredCapacity: 2minSize: 1maxSize: 3Run via
eksctl:Terminal window eksctl create cluster -f ags-eks-cluster.yaml -
Verify you are pointing to the right Kubernetes context:
Terminal window kubectl config get-contextsThe current context should point to your EKS cluster.
-
Verify the EKS cluster is ready:
Terminal window kubectl get nodesYou should see your EKS worker nodes in
Readystate.
Deploying on GKE requires gcloud CLI, kubectl, and Helm.
Deploy AGS on GKE
-
Provision a GKE cluster.
Create a GKE cluster in the same region and availability zone as your Aerospike Database:
Terminal window gcloud container clusters create aerospike-graph1 \--zone us-central1-a \--num-nodes 3 \--machine-type e2-standard-4 \--enable-ip-alias \--no-enable-autoupgrade \--no-enable-autorepair -
Verify you are pointing to the right Kubernetes context:
Terminal window kubectl config get-contextsThe current context should point to your GKE cluster.
-
Verify the GKE cluster is ready:
Terminal window kubectl get nodesYou should see your GKE worker nodes in
Readystate:NAME STATUS ROLES AGE VERSIONgke-aerospike-graph1-default-pool-3da299ff-7qc1 Ready <none> 116s v1.32.4-gke.1415000gke-aerospike-graph1-default-pool-3da299ff-vp25 Ready <none> 116s v1.32.4-gke.1415000gke-aerospike-graph1-default-pool-3da299ff-x9t7 Ready <none> 116s v1.32.4-gke.1415000
Install AGS with Helm
After setting up your Kubernetes cluster, install AGS using Helm.
-
Add the Aerospike Helm repository:
Terminal window helm repo add aerospike https://artifact.aerospike.io/helm -
Update the Helm repository:
Terminal window helm repo update -
Deploy AGS using Helm.
Replace the placeholder values with your Aerospike Database connection details:
AEROSPIKE_HOST: Aerospike Database IP address or hostnameAEROSPIKE_PORT: Aerospike Database port (default 3000)AEROSPIKE_NAMESPACE: Namespace for graph data (for example,test)AEROSPIKE_USERNAME: (optional) Aerospike Database username if access control is enabledAEROSPIKE_PASSWORD: (optional) Aerospike Database password if access control is enabled
Terminal window helm install ags aerospike/aerospike-graph \--set 'env[0].name=aerospike.client.host' \--set 'env[0].value=AEROSPIKE_HOST:AEROSPIKE_PORT' \--set 'env[1].name=aerospike.client.namespace' \--set 'env[1].value=AEROSPIKE_NAMESPACE' \--set 'env[2].name=aerospike.client.user' \--set 'env[2].value=AEROSPIKE_USERNAME' \--set 'env[3].name=aerospike.client.password' \--set 'env[3].value=AEROSPIKE_PASSWORD'For TLS configuration, see TLS between AGS and Aerospike DB.
Check AGS pod status
After deploying AGS, verify the pod is running and check its logs.
-
Check the status of the Aerospike Graph pod:
Terminal window kubectl get podsThe status should be
Running:NAME READY STATUS RESTARTS AGEags-aerospike-graph-589757dd9c-d794m 1/1 Running 0 23m -
Check the logs to verify that AGS initialized successfully.
Replace
AEROSPIKE_GRAPH_POD_NAMEwith the pod name from the previous step:Terminal window kubectl logs AEROSPIKE_GRAPH_POD_NAME -
Get the external IP for connecting to AGS.
The Aerospike Graph Helm chart deploys a Kubernetes Load Balancer Service by default. Its external IP will be used to connect to AGS in the next section. Run
kubectl get svcto check its external IP:Terminal window kubectl get svc
Verify the deployment
Gremlin Console is a command-line interface for executing Gremlin traversals against your running graph service.
-
Download and extract the latest Gremlin Console from the Apache TinkerPop downloads:
Terminal window curl -O https://dlcdn.apache.org/tinkerpop/3.8.0/apache-tinkerpop-gremlin-console-3.8.0-bin.zip && \unzip apache-tinkerpop-gremlin-console-3.8.0-bin.zip && \rm apache-tinkerpop-gremlin-console-3.8.0-bin.zip -
Start the console from the extracted directory:
Terminal window apache-tinkerpop-gremlin-console-3.8.0/bin/gremlin.sh -
Connect to the Aerospike Graph Service instance. Replace
EXTERNAL_IPwith the external IP from the previous section:gremlin> g = traversal().withRemote(DriverRemoteConnection.using("EXTERNAL_IP", 8182, "g"));Example response ==>graphtraversalsource[emptygraph[empty], standard] -
Once you are connected via Gremlin Console and it shows
gremlin>, you can create and read a record to make sure that everything works properly:Run the following command to create a vertex that represents a person:
gremlin> g.addV('person').property('name', 'Alice').property('age', 29)Example response ==>v[-1]List all vertices and their properties and see the newly created vertex:
gremlin> g.V().elementMap()Example response ==>[id:-1,label:person,name:Alice,age:29]