Wondering about Prisma Horizontal Scaling setup? We can help you.
As part of our Server Management Services, we assist our customers with several Prisma queries.
Today, let us see how our Tech goes about its setup.
Prisma Horizontal Scaling setup
Before we begin, there are two important aspects we need to take into consideration.
- The Prisma Management API
Prisma server and Prisma CLI use this API endpoint to perform administrative tasks.
However, with this API, we can only run one instance of the Prisma service.
- The PRISMA_CONFIG
Since it contains both sensitive and non-sensitive information, it is tricky to deal with.
Moving ahead, let us see how our Support Techs perform the Horizontal Scaling setup.
-
Prisma Helm Chart
The Helm chart contains two sets of Deployments and Secrets:
One that does not have the Management API and can scale up with multiple replicas and one that has the Management API and a fixed replica of 1.
-
Chart folder structure
Generally, the chart contains the following files:
k8s/prisma/ ├── Chart.yaml ├── README.md ├── charts │ └── rabbitmq-2.1.1.tgz ├── requirements.lock ├── requirements.yaml ├── templates │ ├── deployment-management.yaml │ ├── deployment.yaml │ ├── secret-management.yaml │ ├── secret.yaml │ └── service.yaml ├── secrets.enc ├── secrets.yaml └── values.yaml
-
RabbitMQ chart dependency
To get the chart dependency, we need to define requirements.yaml and follow the Helm instructions.
We can provide the configuration for the RabbitMQ chart within the main values.yaml as long as it’s grouped by a key with the same name as the dependency chart rabbitmq.
-
Deployment resources
Deployments and secrets are defined twice.
However, the Docker image for Prisma production is, prismagraphql/prisma-prod. This is different from prismagraphql/prisma! (source)
-
Service resource
Service resource points to the “normal” Deployment, not the management one.
-
Install the chart
In order to install the chart we just have to run the helm install command:
$ helm upgrade \ --install \ --wait \ --namespace $NAMESPACE \ -f k8s/prisma/values.yaml \ -f k8s/prisma/secrets.yaml \ $HELM_RELEASE_NAME k8s/prisma
As a result, we will see something similar to this:
$ kubectl get pods NAME READY STATUS prisma-rabbitmq-0 1/1 Running prisma-rabbitmq-1 1/1 Running prisma-6cf659ccc9-8dgg4 2/2 Running prisma-6cf659ccc9-m5fdk 2/2 Running prisma-management-5bb959bbb5-qdbth 2/2 Running $ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) prisma-rabbitmq ClusterIP 10.35.244.85 <none> 4369/TCP,5672/TCP,25672/TCP,15672/TCP 73d prisma ClusterIP 10.35.254.183 <none> 80/TCP
-
Use the Prisma Management API
Say, we have to deploy a schema change. In such a case, we need to connect to the prisma-management-xxx-xx pod.
$ kubectl port-forward prisma-management-5bb959bbb5-qdbth 4467:4466
After that, we need to execute the Prisma deploy command:
$ prisma deploy -e .env
Here, the .env contains the following variables:
PRISMA_API_URL=http://localhost:4467/my-service/staging PRISMA_API_SECRET=xxx PRISMA_MANAGEMENT_API_SECRET=xxx
[Need help with the setup? We are available here for you]
Conclusion
In short, we saw how our Support Techs perform the Prisma Horizontal Scaling setup.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments