Kubernetes
Deploying RestBI in Kubernetes
Kubernetes is a powerful orchestration tool for managing containerized applications at scale. Below is an example of how to deploy RestBI using Kubernetes.
Create a Kubernetes Deployment
Create a restbi-deployment.yaml
file with the following content:
The restbi-deployment.yaml
file sets up the RestBI server within a Kubernetes cluster. Here's what it does:
Deployment:
Replicas: Runs two instances (pods) of the RestBI server for redundancy.
Container:
Image: Uses
restbi/restbi-server:latest
.Ports: Exposes port 3000.
Environment Variables:
DB_HOST: Points to the PostgreSQL service (
postgres-service
).DB_PORT: Set to
5432
.DB_USER, DB_PASSWORD, DB_NAME: Database credentials.
CORS_WHITELIST: Specifies allowed domains for CORS.
Volume Mount: Mounts custom functions from the host to
/app/custom-functions
.
Service:
Type:
LoadBalancer
, making RestBI accessible externally.Ports: Maps incoming traffic on port 80 to port 3000 on the pods.
How It Works:
PostgreSQL Connection: RestBI connects to a PostgreSQL service (
postgres-service
) defined elsewhere in Kubernetes.High Availability: Two replicas ensure redundancy and basic load balancing.
Customization: Users can add custom functions via a mounted volume.
External Access: The LoadBalancer exposes RestBI to the outside world.
Apply the Deployments
To deploy the RestBI server on Kubernetes, run the following commands:
Last updated