> For the complete documentation index, see [llms.txt](https://docs.livestreamiq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.livestreamiq.com/readme-1/2.-installation/2.4-orchestration-installation.md).

# 2.4 Orchestration Installation

This section describes how to deploy LivestreamIQ along with its database (TimescaleDB/PostgreSQL) on Kubernetes (K8s) OpenShift.

The setup of Orchestration Installation includes:

* Application deployment
* Database deployment
* Persistent storage
* Internal service networking
* External exposure (Ingress / Route)

### 1. Pre-Requisite

A functional Kubernetes or OpenShift cluster with at least one node must be available.

Additionally, the following must be ensured:

1. kubectl (for Kubernetes) or oc CLI (for OpenShift) installed
2. A default StorageClass configured for Persistent Volumes
3. Container image available:<br>

   ```
   docker/livestreamiq/livestreqmiq:latest
   ```
4. Cluster has network access to pull images from any registry
5. Basic understanding of YAML manifests and Kubernetes objects

### 2. Installation steps for Kubernetes

Step 1: Create Persistent Volume Claim (Database Storage)

1. Apply the PVC for PostgreSQL storage:<br>

   ```yaml
   apiVersion: v1
   kind: PersistentVolumeClaim
   metadata:
     name: postgres-pvc
   spec:
     accessModes:
       - ReadWriteOnce
     resources:
       requests:
         storage: 100Gi
   ```

Step 2: Deploy PostgreSQL (TimescaleDB)

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres
spec:
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
        - name: postgres
          image: timescale/timescaledb:latest-pg16
          ports:
            - containerPort: 5432
          env:
            - name: POSTGRES_USER
              value: postgres
            - name: POSTGRES_PASSWORD
              value: StrongPassword123
            - name: POSTGRES_DB
              value: lvs
          command: ["postgres", "-c", "shared_preload_libraries=timescaledb"]
          volumeMounts:
            - name: pgdata
              mountPath: /var/lib/postgresql/data
      volumes:
        - name: pgdata
          persistentVolumeClaim:
            claimName: postgres-pvc
```

Step 3: Create PostgreSQL Service

```yaml
apiVersion: v1
kind: Service
metadata:
  name: postgres
spec:
  selector:
    app: postgres
  ports:
    - port: 5432
      targetPort: 5432
  type: ClusterIP
```

Step 4: Deploy LivestreamIQ Application

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: livestreamiq
spec:
  replicas: 2
  selector:
    matchLabels:
      app: livestreamiq
  template:
    metadata:
      labels:
        app: livestreamiq
    spec:
      containers:
        - name: livestreamiq
          image: docker/livestreamiq/livestreqmiq:latest
          ports:
            - containerPort: 8080
          env:
            - name: LVS_DB_URL
              value: "r2dbc:postgresql://postgres:5432/lvs"
            - name: LVS_DB_USERNAME
              value: postgres
            - name: LVS_DB_PASSWORD
              value: StrongPassword123
            - name: ALLOW_ORIGIN
              value: "*"
```

Step 5: Create Application Service

```yaml
apiVersion: v1
kind: Service
metadata:
  name: livestreamiq
spec:
  selector:
    app: livestreamiq
  ports:
    - port: 80
      targetPort: 8080
  type: ClusterIP
```

Step 6: Expose Application

**Kubernetes (Ingress)**

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: livestreamiq-ingress
spec:
  rules:
    - host: livestreamiq.local
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: livestreamiq
                port:
                  number: 80
```

### 3. Installation steps Openshift

1. **Prerequisites**
   1. OpenShift Cluster
   2. Project created\
      Example- *Project Name :* `lvs`
2. The Timescale DB installation steps are provided below:\
   Step -1: Create Secret

   1. Navigate\
      **Workloads → Secrets → Create Secret**
   2. Name: `postgresql`
   3. Add:<br>

      | Key                | Value      |
      | ------------------ | ---------- |
      | POSTGRES\_USER     | postgres   |
      | POSTGRES\_PASSWORD | admin\@123 |
      | POSTGRES\_DB       | lvs        |
   4. Then, Click **Create.**

   \
   Step-2: Create ConfigMap

   1. Navigate:\
      **Workloads → ConfigMaps → Create ConfigMap**
   2. Name: **`postgres-config`**
   3. Data: `PGDATA=/var/lib/postgresql/data/pgdata`
   4. Then, Click **`Create`**

   Step-3: Create TimescaleDB Deployment

   1. Navigate\
      \*\*Workloads →

      Deployments →

      Create Deployment\*\*<br>

      ![](https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-5eb94e682cb6d6558b145a859992f1c4ed8cf092%2Funknown%20\(85\).png?alt=media)
   2. fill the General fields

      1. Name: `postgresql`
      2. Strategy: `Rolling Update`
      3. Leave defaults

      ```
      Max Unavailable
      25%
      Max Surge
      25%
      ```
   3. fill the Image fields\
      Use: `timescale/timescaledb:latest-pg16`
   4. fill the Environment Variables\
      Add the following:<br>

      ```
      Port
      Add Container Port
      5432
      Protocol
      TCP
      ```

      1. Volume: Create Persistent Volume Claim
      2. Mount Path: `/var/lib/postgresql/data`
      3. PVC Name: `timescaledb-pvc`
      4. Size: `100Gi`<br>

         ![](https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-600c4e79ced3dfbccbc62bec1f06cfe4e408b2e8%2Funknown%20\(86\).png?alt=media)

         ![](https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-fcd4e3876530025677fdcc88aea2f49a47181fba%2Funknown%20\(87\).png?alt=media)
      5. Then, Click **Create.**

   \
   Step 4 - Expose TimescaleDB Service

   1. Navigate:\
      **Networking → Service → Create Service**
   2. Past the yml code in the code editor.<br>
      1. ```yaml
         apiVersion: v1
         kind: Service
         metadata:
           name: postgresql-service
           namespace: bidyut-nayak-dev
         spec:
           selector:
             app: postgresql
           ports:
             - protocol: TCP
               port: 5432
               targetPort: 5432

           type: ClusterIP
         ```
   3. Then, Click the **Create** button<br>

      ![](https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-49e4cb5bc12a8143a97c55c020a03eeac1c4ce7f%2Funknown%20\(88\).png?alt=media)

### 4. Deploy LiveStreamIQ Application

The Deploy LVS Application installation steps are provided below:

Step 1: Create Database Secret

1. Navigate:\
   **Workloads → Secrets → Create Secret**
2. Set Name like `lvs-db-secret`\
   Add the following keys:<br>

   | Key               | Value             |
   | ----------------- | ----------------- |
   | LVS\_DB\_USERNAME | postgres          |
   | LVS\_DB\_PASSWORD | StrongPassword123 |
3. Click **Create**.

Step 2: Create ConfigMap

1. Navigate:\
   **Workloads → ConfigMaps → Create ConfigMap**
2. Set Name: example - `lvs-config`
3. Add details:<br>

   | key           | value                               |
   | ------------- | ----------------------------------- |
   | LVS\_DB\_URL  | r2dbc:postgresql://postgres:5432/vs |
   | ALLOW\_ORIGIN | \*                                  |
4. Click **Create**.

Step 3: Create Deployment

1. Navigate:\
   **Workloads → Deployments → Create Deployment**
2. Fill the General value:

   1. Set Name: Example - `lvs`
   2. Set Deployment Strategy: Example- `Rolling Update`
   3. Set Image: Example - `docker.io/your-org/lvs:latest`

   It’s private image create pullimage secret and implement it

Step 4: Go to advance use the pulling image secrete

1. Replace with your actual image.
   1. Container Port
      1. Add: `8080`
   2. Protocol: `TCP`
2. Set Environment Variables:
   1. Configure the following environment variables.\
      From ConfigMap:<br>

      | Environment variable | Source                                 |
      | -------------------- | -------------------------------------- |
      | LVS\_DB\_URL         | ConfigMap → lvs-config → LVS\_DB\_URL  |
      | ALLOW\_ORIGIN        | ConfigMap → lvs-config → ALLOW\_ORIGIN |
   2. For Secret variables:<br>

      | Environment Variable | Source                                     |
      | -------------------- | ------------------------------------------ |
      | LVS\_DB\_USERNAME    | Secret → lvs-db-secret → LVS\_DB\_USERNAME |
      | LVS\_DB\_PASSWORD    | Secret → lvs-db-secret → LVS\_DB\_PASSWORD |

      ![](https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-b014f1435d0ca4e19d5708e088977b7cdad2e2f8%2Funknown%20\(90\).png?alt=media)

Step 5: Expose the Service

1. Go to the **Networking -> service -> Create service**
2. Copy the yml file in the code editor<br>

   ```yaml
   apiVersion: v1
   kind: Service
   metadata:
     name: lvs-service
     namespace: bidyut-nayak-dev
   spec:
     selector:
       app: lvs
     ports:
       - protocol: TCP
         port: 80
         targetPort: 8080

     type: ClusterIP
   ```

   <br>

   ![](https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-5bdab4a9273dd83aeba1a2f3591fc65b69894d7a%2Funknown%20\(91\).png?alt=media)
3. Click the create button

Step 6: Set

1. Create a Route\
   **Networking → Routes → create Route**\
   \
   Ensure Form view is selected.
2. Configure the RouteLeave the remaining fields with their default values.<br>

   | Field value     | Name                            |
   | --------------- | ------------------------------- |
   | Name            | lvs                             |
   | Service         | Select lvs-service              |
   | Target Port     | Select 8080                     |
   | Secure Route    | Check the Secure Route Checkbox |
   | TLS Termination | Select Edge                     |
3. If the User have DNS, then config in hostname
4. Click Create.

### 5. Open the Application

After the route is created:

1. Navigate to Networking → Routes.
2. Click the newly created lvs route.
3. The route details page displays the Location (URL).
4. Click the URL to open the LVS application in your browser.\
   Example: [https://lvs.apps.cluster.example.com](https://lvs.apps.cluster.example.com/)<br>

   ![](https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-1d5370e22c8453fe03d16414ffc0fd578e904d04%2Funknown%20\(92\).png?alt=media)

   ![](https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-4d845d972768fafd0b09b81c5432144d789b1f29%2Funknown%20\(93\).png?alt=media)

   ![](https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-c85d4a672d6d2ba6d6f7bd5f8b122103c4924bdd%2Funknown%20\(94\).png?alt=media)

### 6. Set Configuration:

1. Database Configuration
   1. Database used: PostgreSQL with TimescaleDB extension
   2. Default database name: lvs
   3. Connection handled using internal Kubernetes DNS: `postgres:5432`
2. Application Configuration
   1. Environment variables:<br>

      | Variable          | Description                  |
      | ----------------- | ---------------------------- |
      | LVS\_DB\_URL      | JDBC/R2DBC connection string |
      | LVS\_DB\_USERNAME | Database username            |
      | LVS\_DB\_PASSWORD | Database password            |
      | ALLOW\_ORIGIN     | CORS configuration           |
3. Networking
   1. PostgreSQL is internal only (ClusterIP)
   2. LivestreamIQ is exposed via:
   3. Ingress (Kubernetes)
   4. Route (OpenShift)

### 7. Best practice

1. Security
   1. Do NOT expose PostgreSQL externally
   2. Move credentials to Kubernetes Secrets
   3. Restrict ALLOW\_ORIGIN instead of using "\*" in production
2. Reliability
   1. Use at least 2 replicas for LivestreamIQ
   2. Enable readiness and liveness probes
   3. Use persistent storage for PostgreSQL
3. Scalability
   1. Enable Horizontal Pod Autoscaler (HPA) for LivestreamIQ
   2. Separate database storage using high-performance PVC
   3. Consider read replicas for PostgreSQL if load increases


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.livestreamiq.com/readme-1/2.-installation/2.4-orchestration-installation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
