$npx -y skills add kubesphere/kubesphere --skill opensearchUse when installing or configuring the OpenSearch extension for KubeSphere, which provides distributed search and analytics engine for storing logs, events, auditing, and notification history
| 1 | # OpenSearch Extension |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | OpenSearch is a distributed search and analytics engine built into the KubeSphere WizTelemetry Observability Platform. It is used to store, search, and analyze observability data including logs, auditing events, K8s events, and notification history. |
| 6 | |
| 7 | ## When to Use |
| 8 | |
| 9 | - Installing OpenSearch cluster for KubeSphere observability extensions |
| 10 | - Configuring OpenSearch storage for logging, events, auditing, and notifications |
| 11 | - Managing OpenSearch Dashboard and Curator components |
| 12 | |
| 13 | ## Components |
| 14 | |
| 15 | | Component | Description | Default | |
| 16 | |-----------|-------------|---------| |
| 17 | | opensearch-master | Master node for cluster coordination | 1 replica | |
| 18 | | opensearch-data | Data nodes for storing indices | 3 replicas | |
| 19 | | opensearch-dashboards | Web UI for visualizing data | disabled | |
| 20 | | opensearch-curator | Scheduled task to clean old indices | enabled | |
| 21 | |
| 22 | ## Prerequisites |
| 23 | |
| 24 | ### Check Installation Status |
| 25 | |
| 26 | ```bash |
| 27 | # Check if OpenSearch is installed |
| 28 | kubectl get installplan opensearch -o jsonpath='{.spec.enabled}' |
| 29 | |
| 30 | # Get installed version |
| 31 | kubectl get extension opensearch -o jsonpath='{.status.installedVersion}' |
| 32 | |
| 33 | # Get target clusters |
| 34 | kubectl get installplan opensearch -o jsonpath='{.spec.clusterScheduling.placement.clusters}' |
| 35 | ``` |
| 36 | |
| 37 | Returns: |
| 38 | - `"true"` - installed and enabled |
| 39 | - `"false"` - installed but disabled |
| 40 | - Empty/Error - not installed |
| 41 | |
| 42 | ### Get Available Clusters |
| 43 | |
| 44 | ```bash |
| 45 | kubectl get clusters -o jsonpath='{.items[*].metadata.name}' |
| 46 | ``` |
| 47 | |
| 48 | ### Confirm Target Clusters (MUST DO) |
| 49 | |
| 50 | **⚠️ CRITICAL: Do Not guess.** |
| 51 | |
| 52 | **⚠️ CRITICAL: DO NOT proceed until target clusters are determined.** |
| 53 | |
| 54 | - If user **explicitly specified** target clusters in the request → Use those clusters directly |
| 55 | - If user **did NOT specify** target clusters → You MUST ask user to confirm which clusters to deploy to |
| 56 | |
| 57 | **Ask user (if not specified):** |
| 58 | ``` |
| 59 | Available clusters: host, dev |
| 60 | Which clusters do you want to deploy OpenSearch to? |
| 61 | ``` |
| 62 | |
| 63 | ### Get Latest Version |
| 64 | |
| 65 | **MUST do this to get the latest version:** |
| 66 | |
| 67 | ```bash |
| 68 | kubectl get extensionversions -l kubesphere.io/extension-ref=opensearch -o jsonpath='{range .items[*]}{.spec.version}{"\n"}{end}' | sort -V | tail -1 |
| 69 | ``` |
| 70 | |
| 71 | ## Installation |
| 72 | |
| 73 | **⚠️ CRITICAL: InstallPlan `metadata.name` MUST be `opensearch`. DO NOT use any other name.** |
| 74 | |
| 75 | Use the latest version obtained from "Get Latest Version" step. |
| 76 | |
| 77 | ### Minimal Installation |
| 78 | |
| 79 | ```yaml |
| 80 | apiVersion: kubesphere.io/v1alpha1 |
| 81 | kind: InstallPlan |
| 82 | metadata: |
| 83 | name: opensearch |
| 84 | spec: |
| 85 | extension: |
| 86 | name: opensearch |
| 87 | version: <VERSION> # From Get Latest Version step |
| 88 | enabled: true |
| 89 | upgradeStrategy: Manual |
| 90 | clusterScheduling: |
| 91 | placement: |
| 92 | clusters: |
| 93 | - host |
| 94 | ``` |
| 95 | |
| 96 | ### With OpenSearch Dashboard |
| 97 | |
| 98 | ```yaml |
| 99 | apiVersion: kubesphere.io/v1alpha1 |
| 100 | kind: InstallPlan |
| 101 | metadata: |
| 102 | name: opensearch |
| 103 | spec: |
| 104 | extension: |
| 105 | name: opensearch |
| 106 | version: <VERSION> # From Get Latest Version step |
| 107 | enabled: true |
| 108 | upgradeStrategy: Manual |
| 109 | config: | |
| 110 | opensearch-dashboards: |
| 111 | enabled: true |
| 112 | clusterScheduling: |
| 113 | placement: |
| 114 | clusters: |
| 115 | - host |
| 116 | ``` |
| 117 | |
| 118 | ### Disable Curator |
| 119 | |
| 120 | ```yaml |
| 121 | apiVersion: kubesphere.io/v1alpha1 |
| 122 | kind: InstallPlan |
| 123 | metadata: |
| 124 | name: opensearch |
| 125 | spec: |
| 126 | extension: |
| 127 | name: opensearch |
| 128 | version: <VERSION> # From Get Latest Version step |
| 129 | enabled: true |
| 130 | upgradeStrategy: Manual |
| 131 | config: | |
| 132 | opensearch-curator: |
| 133 | enabled: false |
| 134 | clusterScheduling: |
| 135 | placement: |
| 136 | clusters: |
| 137 | - host |
| 138 | ``` |
| 139 | |
| 140 | ## Configuration |
| 141 | |
| 142 | ### Parameters |
| 143 | |
| 144 | | Parameter | Type | Default | Description | |
| 145 | |-----------|------|---------|-------------| |
| 146 | | `opensearch-master.replicas` | int | 1 | Number of master nodes | |
| 147 | | `opensearch-master.opensearchJavaOpts` | string | "-Xmx512M -Xms512M" | JVM options | |
| 148 | | `opensearch-master.resources` | object | - | Resource limits/requests | |
| 149 | | `opensearch-data.replicas` | int | 3 | Number of data nodes | |
| 150 | | `opensearch-data.opensearchJavaOpts` | string | "-Xmx1536M -Xms1536M" | JVM options | |
| 151 | | `opensearch-data.resources` | object | - | Resource limits/requests | |
| 152 | | `opensearch-data.service.type` | string | NodePort | Service type | |
| 153 | | `opensearch-data.service.nodePort` | int | 30920 | NodePort for external access | |
| 154 | | `opensearch-dashboards.enabled` | bool | false | Enable OpenSearch Dashboards | |
| 155 | | `opensearch-curator.enabled` | bool | true | Enable index cleanup job | |
| 156 | |
| 157 | ### Resource Configuration |
| 158 | |
| 159 | ```yaml |
| 160 | opensearch-master: |
| 161 | replicas: 1 |
| 162 | opensearchJavaOpts: "-Xmx512M -Xms512M" |
| 163 | resources: |
| 164 | requests: |
| 165 | cpu: "100m" |
| 166 | memory: "512Mi" |
| 167 | limits: |
| 168 | cpu: "500m" |
| 169 | memory: "1Gi" |
| 170 | |
| 171 | opensearch-data: |
| 172 | replicas: 3 |
| 173 | opensearchJavaOpts: "-Xmx2048M -Xms2048M" |
| 174 | resources: |
| 175 | requests: |
| 176 | cpu: "200m" |
| 177 | memory: "2Gi" |
| 178 | limits: |
| 179 | cpu: "2000m" |
| 180 | memory: "4Gi" |
| 181 | persistence: |