Helm/Elasticsearch: Difference between revisions
Jump to navigation
Jump to search
(Created page with " helm repo add bitnami https://charts.bitnami.com/bitnami helm repo update && helm repo list kubectl config get-contexts ==Config== <syntaxhighlight lang="properties"> export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml" export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml" export KUBECONFIG="${HOME}/.kube/config" </syntaxhighlight> ==Install== {| |valign="top"| <syntaxhighlight lang="bash"> helm show values bitnami/elasticsearch --version=21.4.0|less helm show val...") |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 142: | Line 142: | ||
ingress: | ingress: | ||
path: / | path: / | ||
enabled: true | |||
ingressClassName: nginx | |||
hostname: elasticsearch.k8s.local | hostname: elasticsearch.k8s.local | ||
security: | |||
existingSecret: elasticsearch | |||
master: | master: | ||
masterOnly: false | |||
replicaCount: 1 | replicaCount: 1 | ||
data: | |||
replicaCount: 0 | |||
ingest: | ingest: | ||
replicaCount: | replicaCount: 0 | ||
coordinating: | coordinating: | ||
replicaCount: | replicaCount: 0 | ||
YML | YML | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 195: | Line 198: | ||
| colspan="2" | | | colspan="2" | | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
kubectl -n=elasticsearch exec -it svc/elasticsearch -c=elasticsearch- | kubectl -n=elasticsearch exec -it svc/elasticsearch -c=elasticsearch -- bash | ||
kubectl -n=elasticsearch exec -it svc/elasticsearch -c=elasticsearch | kubectl -n=elasticsearch exec -it svc/elasticsearch -c=elasticsearch -- sh | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 235: | Line 238: | ||
| valign="top" | | | valign="top" | | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
kubectl -n=elasticsearch rollout history | kubectl -n=elasticsearch rollout history sts elasticsearch-master | ||
kubectl -n=elasticsearch rollout restart | kubectl -n=elasticsearch rollout restart sts elasticsearch-master | ||
kubectl -n=elasticsearch rollout status | kubectl -n=elasticsearch rollout status sts elasticsearch-master | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| valign="top" | | | valign="top" | | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
kubectl -n=elasticsearch logs -f svc/elasticsearch -c=elasticsearch | kubectl -n=elasticsearch logs -f svc/elasticsearch -c=elasticsearch | ||
kubectl -n=elasticsearch exec -it svc/elasticsearch -- sh | kubectl -n=elasticsearch exec -it svc/elasticsearch -- sh | ||
kubectl -n=elasticsearch logs -f svc/elasticsearch | kubectl -n=elasticsearch logs -f svc/elasticsearch |
Latest revision as of 22:29, 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/elasticsearch --version=21.4.0|less
helm show values bitnami/elasticsearch --version=21.4.1|less
kubectl get ns|grep elasticsearch
kubectl delete ns elasticsearch
kubectl create ns elasticsearch
|
kubectl get ns|grep elasticsearch
kubectl -n=elasticsearch create secret generic elasticsearch \
--from-literal=elasticsearch-password=sadaqah! \
--dry-run=client -o=yaml \
| kubectl apply -f=-
|
| |
cat <<ENV | kubectl -n=elasticsearch create secret generic elasticsearch --from-env-file=/dev/stdin
elasticsearch-password=sadaqah!
ENV
| |
| |
cat << YML | kubectl -n=elasticsearch apply -f=-
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-elasticsearch
spec:
persistentVolumeReclaimPolicy: Retain
storageClassName: standard
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/hostpath-provisioner/elasticsearch/pvc-elasticsearch
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/name: elasticsearch
name: pvc-elasticsearch
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
volumeName: pv-elasticsearch
YML
|
cat << YML | kubectl -n=elasticsearch apply -f=-
---
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/name: elasticsearch
name: pvc-elasticsearch
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
YML
|
| |
PV_NAME="$(kubectl -n=elasticsearch get pvc pvc-elasticsearch -o=yaml|yq -r .spec.volumeName)"
cat <<YML |kubectl -n=elasticsearch patch pv ${PV_NAME} --patch-file=/dev/stdin
---
spec:
persistentVolumeReclaimPolicy: Retain
YML
| |
| |
cat <<YML | helm -n=elasticsearch install elasticsearch bitnami/elasticsearch --version=21.4.1 -f=-
---
ingress:
path: /
enabled: true
ingressClassName: nginx
hostname: elasticsearch.k8s.local
security:
existingSecret: elasticsearch
master:
masterOnly: false
replicaCount: 1
data:
replicaCount: 0
ingest:
replicaCount: 0
coordinating:
replicaCount: 0
YML
| |
| |
xdg-open http://elasticsearch.k8s.local &>/dev/null &
gnome-open http://elasticsearch.k8s.local &>/dev/null &
|
x-www-browser http://elasticsearch.k8s.local &>/dev/null &
sensible-browser http://elasticsearch.k8s.local &>/dev/null &
|
Uninstall
helm uninstall -n=elasticsearch elasticsearch
kubectl delete namespace elasticsearch
Playground
helm -n=elasticsearch install elasticsearch bitnami/elasticsearch --version=21.4.0
helm -n=elasticsearch upgrade -i elasticsearch bitnami/elasticsearch --version=21.4.1
helm show values bitnami/elasticsearch --version=21.4.1|less
| |
| |
kubectl -n=elasticsearch exec -it svc/elasticsearch -c=elasticsearch -- bash
kubectl -n=elasticsearch exec -it svc/elasticsearch -c=elasticsearch -- 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=elasticsearch delete all --all
kubectl -n=elasticsearch delete ing --all
kubectl -n=elasticsearch delete sts --all
|
kubectl -n=elasticsearch delete svc --all
kubectl -n=elasticsearch delete pvc --all
kubectl -n=elasticsearch delete pv --all
|
| |
kubectl -n=elasticsearch rollout history sts elasticsearch-master
kubectl -n=elasticsearch rollout restart sts elasticsearch-master
kubectl -n=elasticsearch rollout status sts elasticsearch-master
|
kubectl -n=elasticsearch logs -f svc/elasticsearch -c=elasticsearch
kubectl -n=elasticsearch exec -it svc/elasticsearch -- sh
kubectl -n=elasticsearch logs -f svc/elasticsearch
|
References
| ||