Helm/OpenSearch: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
m (Shahed moved page Helm/Opensearch to Helm/OpenSearch without leaving a redirect: Misspelled title)
No edit summary
Line 1: Line 1:
  helm repo add bitnami https://charts.bitnami.com/bitnami
  helm repo add bitnami https://charts.bitnami.com/bitnami
  helm repo update && helm repo list
  helm repo update && helm repo list
Line 14: Line 15:
|valign="top"|
|valign="top"|
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
helm show values opensearch/opensearch --version=1.4.0|less
helm show values bitnami/opensearch --version=1.4.0|less
helm show values opensearch/opensearch --version=1.5.0|less
helm show values bitnami/opensearch --version=1.5.0|less


kubectl get ns|grep opensearch
kubectl get ns|grep opensearch
Line 139: Line 140:
|colspan="2"|
|colspan="2"|
<syntaxhighlight lang="yaml">
<syntaxhighlight lang="yaml">
cat <<YML | helm -n=opensearch install    opensearch opensearch/opensearch --version=1.5.0 -f=-
cat <<YML | helm -n=opensearch install    opensearch bitnami/opensearch --version=1.5.0 -f=-
---
---
ingress:
ingress:
   path: /
   path: /
   hosts:
   hostname: opensearch.k8s.local
  - opensearch.k8s.local
   ingressClassName: nginx
   ingressClassName: nginx
   enabled: true
   enabled: true
replicas: 1
data:
nodeGroup: master
  replicaCount: 1
clusterName: opensearch
master:
nameOverride: opensearch
  replicaCount: 1
fullnameOverride: opensearch
ingest:
masterService: opensearch-master
  replicaCount: 1
coordinating:
  replicaCount: 1
YML
YML
</syntaxhighlight>
</syntaxhighlight>
Line 184: Line 186:
| colspan="2" |
| colspan="2" |
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
helm -n=opensearch install    opensearch opensearch/opensearch --version=1.4.0
helm -n=opensearch install    opensearch bitnami/opensearch --version=1.4.0
helm -n=opensearch upgrade -i opensearch opensearch/opensearch --version=1.5.0
helm -n=opensearch upgrade -i opensearch bitnami/opensearch --version=1.5.0
helm show values opensearch/opensearch --version=1.5.0|less
helm show values bitnami/opensearch --version=1.5.0|less
</syntaxhighlight>
</syntaxhighlight>


Line 195: Line 197:
| colspan="2" |
| colspan="2" |
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
kubectl -n=opensearch exec -it svc/opensearch-master -c=fsgroup-volume -- sh
kubectl -n=opensearch exec -it svc/opensearch -c=opensearch-coordinating-0 -- sh
kubectl -n=opensearch exec -it svc/opensearch-master -c=opensearch -- sh
kubectl -n=opensearch exec -it svc/opensearch -c=opensearch-master-0 -- sh
</syntaxhighlight>
</syntaxhighlight>


Line 242: Line 244:
| valign="top" |
| valign="top" |
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
kubectl -n=opensearch logs -f  svc/opensearch-master -c=opensearch
kubectl -n=opensearch logs -f  svc/opensearch -c=opensearch-master-0
kubectl -n=opensearch exec -it svc/opensearch-master -- sh
kubectl -n=opensearch exec -it svc/opensearch -- sh
kubectl -n=opensearch logs -f  svc/opensearch-master
kubectl -n=opensearch logs -f  svc/opensearch
</syntaxhighlight>
</syntaxhighlight>



Revision as of 02:08, 16 December 2024

helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update && helm repo list
kubectl config get-contexts

Config

export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/config"

Install

helm show values bitnami/opensearch --version=1.4.0|less
helm show values bitnami/opensearch --version=1.5.0|less

kubectl get ns|grep opensearch
kubectl delete ns   opensearch
kubectl create ns   opensearch
kubectl -n=opensearch create secret generic opensearch \
--from-literal=opensearch-dashboards-password=sadaqah! \
--from-literal=opensearch-password=sadaqah! \
--from-literal=logstash-password=sadaqah! \
--dry-run=client -o=yaml \
| kubectl apply -f=-

cat <<ENV | kubectl -n=opensearch create secret generic opensearch --from-env-file=/dev/stdin
opensearch-dashboards-password=sadaqah!
opensearch-password=sadaqah!
logstash-password=sadaqah!
ENV

cat << YML | kubectl -n=opensearch apply -f=-
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-opensearch
spec:
  persistentVolumeReclaimPolicy: Retain
  storageClassName: standard
  capacity:
    storage: 10Gi
  accessModes:
  - ReadWriteOnce
  hostPath:
    path: /tmp/hostpath-provisioner/opensearch/pvc-opensearch
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    app.kubernetes.io/name: opensearch
  name: pvc-opensearch
spec:
  storageClassName: standard
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  volumeName: pv-opensearch
YML
cat << YML | kubectl -n=opensearch apply -f=-
---













---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    app.kubernetes.io/name: opensearch
  name: pvc-opensearch
spec:
  storageClassName: standard
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi

YML

PV_NAME="$(kubectl -n=opensearch get   pvc pvc-opensearch -o=yaml|yq -r .spec.volumeName)"
cat <<YML |kubectl -n=opensearch patch pv ${PV_NAME} --patch-file=/dev/stdin
---
spec:
  persistentVolumeReclaimPolicy: Retain
YML

cat <<YML | helm -n=opensearch install    opensearch bitnami/opensearch --version=1.5.0 -f=-
---
ingress:
  path: /
  hostname: opensearch.k8s.local
  ingressClassName: nginx
  enabled: true
data:
  replicaCount: 1
master:
  replicaCount: 1
ingest:
  replicaCount: 1
coordinating:
  replicaCount: 1
YML

  xdg-open http://opensearch.k8s.local &>/dev/null &
gnome-open http://opensearch.k8s.local &>/dev/null &
   x-www-browser http://opensearch.k8s.local &>/dev/null &
sensible-browser http://opensearch.k8s.local &>/dev/null &

Uninstall

helm uninstall -n=opensearch opensearch
kubectl delete namespace opensearch

Playground

helm -n=opensearch install    opensearch bitnami/opensearch --version=1.4.0
helm -n=opensearch upgrade -i opensearch bitnami/opensearch --version=1.5.0
helm show values bitnami/opensearch --version=1.5.0|less

kubectl -n=opensearch exec -it svc/opensearch -c=opensearch-coordinating-0 -- sh
kubectl -n=opensearch exec -it svc/opensearch -c=opensearch-master-0 -- sh

kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/gcp-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten

kubectl -n=opensearch delete all --all
kubectl -n=opensearch delete ing --all
kubectl -n=opensearch delete sts --all
kubectl -n=opensearch delete svc --all
kubectl -n=opensearch delete pvc --all
kubectl -n=opensearch delete pv  --all

kubectl -n=opensearch rollout history deploy opensearch
kubectl -n=opensearch rollout restart deploy opensearch
kubectl -n=opensearch rollout status  deploy opensearch
kubectl -n=opensearch logs -f  svc/opensearch -c=opensearch-master-0
kubectl -n=opensearch exec -it svc/opensearch -- sh
kubectl -n=opensearch logs -f  svc/opensearch

References