Skip to content

Commit

Permalink
feat(opensearch): add k8s-install.sh helper ingress
Browse files Browse the repository at this point in the history
  • Loading branch information
mborne committed Oct 10, 2023
1 parent afc7c8a commit c6af435
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
19 changes: 5 additions & 14 deletions opensearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,15 @@ WARNING : Read [docker-compose.yml](docker-compose.yml) and note that **security

## Usage with Kubernetes

* Add helm chart : `helm repo add opensearch https://opensearch-project.github.io/helm-charts/`
* Update helm repositories : `helm repo update`
* Create namespace : `kubectl create namespace opensearch`
* Install OpenSearch :
Read [k8s-install.sh](k8s-install.sh) and run :

```bash
# With default values
helm -n opensearch install opensearch opensearch/opensearch
# or to disable TLS and basic auth :
#helm -n opensearch install -f opensearch/helm/insecure.yml opensearch opensearch/opensearch
# To get opensearch-dashboards on http://opensearch-dashboards.dev.localhost
bash k8s-install.sh
# To get opensearch-dashboards on http://opensearch-dashboards.example.net
DEVBOX_HOSTNAME=example.net bash k8s-install.sh
```

* Watch all cluster members come up : `kubectl -n opensearch get pods -w`

* Access from host : `kubectl -n opensearch port-forward service/opensearch-cluster-master 19200:9200`
* https://127.0.0.1:19200 using admin/admin with default values
* http://127.0.0.1:19200 with [helm/insecure.yml](helm/insecure.yml) values

## Resources

* [opensearch.org - Install OpenSearch / Docker](https://opensearch.org/docs/latest/opensearch/install/docker/)
Expand Down
28 changes: 28 additions & 0 deletions opensearch/k8s-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,31 @@ helm -n opensearch upgrade --install opensearch-cluster opensearch/opensearch

# Install opensearch dashboard
helm -n opensearch upgrade --install opensearch-dashboards opensearch/opensearch-dashboards


# Create Ingress with dynamic hostname
cat <<EOF | kubectl -n opensearch apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: opensearch-dashboards
annotations:
cert-manager.io/cluster-issuer: "${DEVBOX_ISSUER}"
spec:
ingressClassName: ${DEVBOX_INGRESS}
rules:
- host: opensearch-dashboards.$DEVBOX_HOSTNAME
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: opensearch-dashboards
port:
number: 5601
tls:
- hosts:
- opensearch-dashboards.$DEVBOX_HOSTNAME
secretName: opensearch-dashboards-cert
EOF

0 comments on commit c6af435

Please sign in to comment.