Multiple Luna instances in a single cluster
Tip
Running multiple Luna instances is useful when different workloads require different scaling behavior, node selection rules, or placement constraints.
Running Multiple Luna Instances
Luna can be deployed multiple times within a single Kubernetes cluster to support different configurations or workload profiles. Each Luna instance operates independently and can target a distinct set of pods using labels or annotations.
Service account management
Luna requires a Kubernetes service account to authenticate with the cloud provider and perform node provisioning. When running multiple Luna instances in the same cluster, you can either reuse a single service account or create separate service accounts per instance, depending on your requirements.
Reusing a single service account
A single Kubernetes service account can be shared across multiple Luna instances. This is useful when all instances require the same permissions and operate within the same namespace.
In this model:
- The first Luna installation creates the service account.
- Subsequent Luna installations reuse the existing service account.
- To avoid conflicts, set the Helm value
serviceAccount.create=falsefor all subsequent installations.
Once the service account has been created by the initial Luna installation, all additional Luna instances reference that same account.
Example: Multiple Luna instances on GKE
First, deploy the initial Luna instance in the target namespace:
cd luna-*/deploy/gke
./deploy.sh --name <cluster> --region <region> --namespace <namespace> ...
kubectl get deployments -n <namespace>
Next, create a Helm values file defining the configuration for an additional Luna instance:
cat <<EOF > my_luna_instance.yaml
appName: my-luna-instance
labels: env=dev,workload=foo
nodeTags:
env: dev
workload: foo
EOF
Then install the additional Luna instance using Helm, referencing both the cluster-level values file and the instance-specific configuration. For subsequent installations, disable service account creation:
helm install luna-inst-2 ./luna-v*.tgz \
--namespace <namespace> \
--set serviceAccount.create=false \
-f <cluster>_values.yaml \
-f my-luna-instance.yaml
Managing service accounts with deploy.sh
You can also deploy multiple Luna instances using the deploy.sh script. When doing so, each instance must have a unique Helm release name. Service account behavior is controlled using the service account prefix.
Kubernetes service account prefix
To customize the Kubernetes service account name prefix, use the deploy script option:
--service-account-prefix <prefix>
Note When using
--service-account-prefix, do not specifyserviceAccount.prefixvia--additional-helm-values, as this combination is not supported.
To reuse a single service account across multiple Luna instances, all Luna instances must:
- Be deployed into the same namespace
- Use a unique Helm release name
- Use unique
labelsorpodAnnotations - Set
serviceAccount.create=falsefor subsequent deployments
To deploy multiple Luna instances, each in a different namespace, all instances must:
- Use a unique
--helm-release-namename - Use a unique
labelsorpodAnnotations - Use a unique service account prefix,
--service-account-prefix
Example with deploy.sh, using the same namespace (default: elotl)
For example, deploy the first Luna instance:
./deploy.sh ... \
--helm-release-name inst-1 \
-- ... \
--additional-helm-values "--set labels='elotl-luna-inst-1=true'"
Then deploy additional Luna instances that reuse the same service account:
./deploy.sh ... \
--helm-release-name inst-2 \
-- ... \
--additional-helm-values "--set labels='elotl-luna-inst-2=true' --set serviceAccount.create=false"
Example with deploy.sh, using the different namespaces
For example, deploy the first Luna instance:
./deploy.sh ... \
--helm-release-name inst-1 \
--namespace luna-inst-1 \
--service-account-prefix inst-1 \
... \
--additional-helm-values "--set labels='elotl-luna-inst-1=true'"
Then deploy additional Luna instances using separate service accounts:
./deploy.sh ... \
--helm-release-name inst-2 \
--namespace luna-inst-2 \
--service-account-prefix inst-2 \
... \
--additional-helm-values "--set labels='elotl-luna-inst-2=true'"
Note The Helm values
serviceAccount.createandserviceAccount.prefixare available starting with Luna version 0.6.2.