Deploy Multiple Aerospike Clusters on Kubernetes
The Aerospike Kubernetes Operator can deploy multiple Aerospike clusters within a single Kubernetes namespace, or in multiple namespaces.
Multiple Aerospike Clusters in a Single Namespace
You can deploy multiple clusters in a single namespace using the same process as deploying a single cluster. When you deploy another cluster, use a cluster name which is not already registered in that namespace as described by the cluster object metadata name in the CR YAML file.
RBAC for Other Namespaces
The procedure to use the namespace ns1
is as follows:
Create the namespace
Create the Kubernetes namespace if not already created:
kubectl create namespace ns1
Create a service account
kubectl -n ns1 create serviceaccount aerospike-operator-controller-manager
Update the operator's ClusterRoleBinding
Next, add this service account to the Operator's ClusterRoleBinding
. To do this, run the following command:
kubectl edit clusterrolebindings.rbac.authorization.k8s.io $(kubectl get clusterrolebindings.rbac.authorization.k8s.io | grep aerospike-kubernetes-operator | grep -v -- "-opera-" | grep -v -- "default-ns" | cut -f 1 -d " ")
This command launches an editor. Append the following lines to the subjects
section:
# A new entry for ns1.
# Replace ns1 with your namespace
- kind: ServiceAccount
name: aerospike-operator-controller-manager
namespace: ns1
Save and ensure that the changes are applied.
Here is a full example of the Operator's ClusterRoleBinding targeting the ns1
namespace.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: "2022-06-16T10:48:36Z"
labels:
olm.owner: aerospike-kubernetes-operator.v2.4.0
olm.owner.kind: ClusterServiceVersion
olm.owner.namespace: test
operators.coreos.com/aerospike-kubernetes-operator.test: ""
name: aerospike-kubernetes-operator.v2.4.0-74b946466d
resourceVersion: "51841234"
uid: be546dd5-b21e-4cc3-8a07-e2fe5fe5274c
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: aerospike-kubernetes-operator.v2.4.0-74b946466d
subjects:
- kind: ServiceAccount
name: aerospike-operator-controller-manager
namespace: operators
# New entry
- kind: ServiceAccount
name: aerospike-operator-controller-manager
namespace: ns1