Helm/OpenSearch: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
Line 15: Line 15:
|valign="top"|
|valign="top"|
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
helm show values bitnami/opensearch --version=1.4.0|less
helm show values bitnami/opensearch --version=1.5.0|less
helm show values bitnami/opensearch --version=1.5.0|less
helm show values bitnami/opensearch --version=1.5.1|less


kubectl get ns|grep opensearch
kubectl get ns|grep opensearch
Line 140: Line 140:
|colspan="2"|
|colspan="2"|
<syntaxhighlight lang="yaml">
<syntaxhighlight lang="yaml">
cat <<YML | helm -n=opensearch install    opensearch bitnami/opensearch --version=1.5.0 -f=-
cat <<YML | helm -n=opensearch install    opensearch bitnami/opensearch --version=1.5.1 -f=-
---
---
ingress:
ingress:
Line 147: Line 147:
   ingressClassName: nginx
   ingressClassName: nginx
   enabled: true
   enabled: true
data:
  replicaCount: 1
master:
master:
  masterOnly: false
   replicaCount: 1
   replicaCount: 1
data:
  replicaCount: 0
ingest:
ingest:
   replicaCount: 1
   replicaCount: 0
coordinating:
coordinating:
   replicaCount: 1
   replicaCount: 0
YML
YML
</syntaxhighlight>
</syntaxhighlight>

Revision as of 20:36, 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.5.0|less
helm show values bitnami/opensearch --version=1.5.1|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.1 -f=-
---
ingress:
  path: /
  hostname: opensearch.k8s.local
  ingressClassName: nginx
  enabled: true
master:
  masterOnly: false
  replicaCount: 1
data:
  replicaCount: 0
ingest:
  replicaCount: 0
coordinating:
  replicaCount: 0
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