Helm/OpenSearch: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
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.5.0|less
helm show values opensearch/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 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.1 -f=-
---
---
ingress:
ingress:
   path: /
   path: /
   hosts:
   hostname: opensearch.k8s.local
  - opensearch.k8s.local
   ingressClassName: nginx
   ingressClassName: nginx
   enabled: true
   enabled: true
replicas: 1
security:
nodeGroup: master
  existingSecret: opensearch
clusterName: opensearch
master:
nameOverride: opensearch
  masterOnly: false
fullnameOverride: opensearch
  replicaCount: 1
masterService: opensearch-master
data:
  replicaCount: 0
ingest:
  replicaCount: 0
coordinating:
  replicaCount: 0
YML
YML
</syntaxhighlight>
</syntaxhighlight>
Line 184: Line 189:
| 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.5.0
helm -n=opensearch upgrade -i opensearch opensearch/opensearch --version=1.5.0
helm -n=opensearch upgrade -i opensearch bitnami/opensearch --version=1.5.1
helm show values opensearch/opensearch --version=1.5.0|less
helm show values bitnami/opensearch --version=1.5.1|less
</syntaxhighlight>
</syntaxhighlight>


Line 195: Line 200:
| 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 -- bash
kubectl -n=opensearch exec -it svc/opensearch-master -c=opensearch -- sh
kubectl -n=opensearch exec -it svc/opensearch -c=opensearch -- sh
</syntaxhighlight>
</syntaxhighlight>


Line 235: Line 240:
| valign="top" |
| valign="top" |
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
kubectl -n=opensearch rollout history deploy opensearch
kubectl -n=opensearch rollout history sts opensearch-master
kubectl -n=opensearch rollout restart deploy opensearch
kubectl -n=opensearch rollout restart sts opensearch-master
kubectl -n=opensearch rollout status  deploy opensearch
kubectl -n=opensearch rollout status  sts opensearch-master
</syntaxhighlight>
</syntaxhighlight>


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


Line 254: Line 259:
* [[Helm/Prometheus Stack|Helm » Prometheus Stack]]
* [[Helm/Prometheus Stack|Helm » Prometheus Stack]]
* [[Helm/Cert Manager|Helm » Cert Manager]]
* [[Helm/Cert Manager|Helm » Cert Manager]]
* [[Helm/Elasticsearch|Helm » Elasticsearch]]
* [https://artifacthub.io/packages/helm/bitnami/opensearch Helm » OpenSearch]
* [https://artifacthub.io/packages/helm/bitnami/opensearch Helm » OpenSearch]
* [[Helm/GitLab|Helm » GitLab]]
* [[Helm/GitLab|Helm » GitLab]]

Latest revision as of 22:41, 17 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
security:
  existingSecret: opensearch
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.5.0
helm -n=opensearch upgrade -i opensearch bitnami/opensearch --version=1.5.1
helm show values bitnami/opensearch --version=1.5.1|less

kubectl -n=opensearch exec -it svc/opensearch -c=opensearch -- bash
kubectl -n=opensearch exec -it svc/opensearch -c=opensearch -- 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 sts opensearch-master
kubectl -n=opensearch rollout restart sts opensearch-master
kubectl -n=opensearch rollout status  sts opensearch-master
kubectl -n=opensearch exec -it svc/opensearch -c=opensearch -- bash
kubectl -n=opensearch logs -f  svc/opensearch -c=opensearch
kubectl -n=opensearch logs -f  svc/opensearch

References