Reference Architecture Note: This setup uses third-party components. Versions, defaults, and command syntax may change over time. Address any issues not specific to SambaStack to the vendor or project that owns that component.
Prerequisites
Before you begin, ensure you have the following:- kubectl — Configured with access to your target Kubernetes cluster
- Helm (latest version) — For deploying the OpenSearch chart
- jq — For parsing JSON output during verification
- Storage class — A valid storage class available in your Kubernetes environment for persistent volume provisioning
Deployment Order: OpenSearch should be deployed before Fluent Bit and before Prometheus/Grafana if you want log visualization in Grafana.
Resource requirements
The following are minimum resource recommendations for OpenSearch:| Deployment Type | CPU | Memory | Storage |
|---|---|---|---|
| Single-node (dev/test) | 2 cores | 4 GB | 50 GB |
| Multi-node (production) | 4 cores per node | 8 GB per node | 100 GB per node |
OpenSearch is memory-intensive. For production workloads, allocate at least 50% of available memory to the JVM heap, with a maximum of 32 GB. Set these values in the
opensearch-values.yaml file using the esJavaOpts parameter, for example: esJavaOpts: "-Xmx16g -Xms16g".Architecture overview
In the SambaStack monitoring stack, OpenSearch serves as the central log repository:- Receives logs from Fluent Bit via HTTPS (port 9200)
- Stores logs in time-based indices (default:
logs-7d) - Provides search APIs for Grafana dashboards and direct queries
- Runs as a StatefulSet with persistent storage
Deployment steps
Step 1: Create the monitoring namespace
Start by creating a dedicated namespace for all monitoring components. This namespace is shared by OpenSearch, Fluent Bit, Prometheus, and Grafana. Create a file namedmonitoring-namespace.yaml:
Step 2: Create the admin password secret
OpenSearch requires an initial admin password at install time, which is injected via a Kubernetes secret. First, generate a base64-encoded password:opensearch-initial-admin-password-secret.yaml, replacing the placeholder with your encoded password:
Step 3: Configure Helm values
Create a file namedopensearch-values.yaml to customize the deployment. Replace <your-storage-class> with your cluster’s storage class name:
The
replicas: 1 setting deploys a single-node cluster suitable for development and testing. For production high-availability deployments, increase the replica count to at least 3 and ensure your storage class supports multi-AZ provisioning.Step 4: Install OpenSearch
Add the official OpenSearch Helm repository and install the chart:Verification
Once the installation completes, verify that OpenSearch is running correctly.Check pod status
Test API connectivity
Set up port forwarding to access the OpenSearch API locally:Success criteria
Your OpenSearch installation is complete when:- The
opensearch-cluster-master-0pod showsRunningstatus with1/1ready - The OpenSearch API returns valid cluster information via curl
- The
opensearch-initial-admin-passwordsecret exists in themonitoringnamespace
Configuration reference
| Parameter | Default | Description |
|---|---|---|
replicas | 1 | Number of OpenSearch nodes. Use 3+ for production HA |
persistence.enabled | true | Enable persistent storage for indices |
persistence.storageClass | — | Kubernetes storage class for PVCs |
| Index name | logs-7d | Default index created by Fluent Bit (configured in Fluent Bit, not OpenSearch) |
Troubleshooting
Pod stuck in Pending state
Symptom:opensearch-cluster-master-0 remains in Pending status.
Cause: Usually indicates a PersistentVolumeClaim (PVC) cannot be fulfilled.
Solution:
Pod in CrashLoopBackOff
Symptom: Pod repeatedly crashes and restarts. Cause: Often caused by insufficient memory or missing password secret. Solution:Connection refused on port 9200
Symptom:curl returns “Connection refused” even with port-forward active.
Solution:
Next steps
After OpenSearch is running:- Deploy Fluent Bit — Set up log forwarding to populate OpenSearch with cluster logs. See Log Forwarding with Fluent Bit.
- Deploy Prometheus and Grafana — Add metrics collection and visualization. The Grafana deployment includes an OpenSearch datasource for log exploration. See Monitoring with Prometheus and Grafana.
