Mendeploy CRD
root@syslog01:~# kubectl create -f https://download.elastic.co/downloads/eck/2.13.0/crds.yaml customresourcedefinition.apiextensions.k8s.io/agents.agent.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/apmservers.apm.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/beats.beat.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/elasticmapsservers.maps.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/elasticsearchautoscalers.autoscaling.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/elasticsearches.elasticsearch.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/enterprisesearches.enterprisesearch.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/kibanas.kibana.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/logstashes.logstash.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/stackconfigpolicies.stackconfigpolicy.k8s.elastic.co created root@syslog01:~#
Mendeploy operator ECK
root@syslog01:~# kubectl apply -f https://download.elastic.co/downloads/eck/2.13.0/operator.yaml namespace/elastic-system created serviceaccount/elastic-operator created secret/elastic-webhook-server-cert created configmap/elastic-operator created clusterrole.rbac.authorization.k8s.io/elastic-operator created clusterrole.rbac.authorization.k8s.io/elastic-operator-view created clusterrole.rbac.authorization.k8s.io/elastic-operator-edit created clusterrolebinding.rbac.authorization.k8s.io/elastic-operator created service/elastic-webhook-server created statefulset.apps/elastic-operator created validatingwebhookconfiguration.admissionregistration.k8s.io/elastic-webhook.k8s.elastic.co created root@syslog01:~#
Memulai deployment elastic dengan jumlah node 2
root@syslog01:~# cat <<EOF | kubectl apply -f -
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: es-7-17-23
spec:
version: 7.17.23 # Ganti versi sesuai dengan versi Elasticsearch 7 yang Anda inginkan
nodeSets:
- name: elastic-node
count: 2
config:
node.store.allow_mmap: false
EOF
elasticsearch.elasticsearch.k8s.elastic.co/es-7-17-23 created
root@syslog01:~#
Untuk menghapus
root@syslog01:~# kubectl delete elasticsearch es-7-16-3 -n elasticstack elasticsearch.elasticsearch.k8s.elastic.co "es-7-16-3" deleted root@syslog01:~#
Untuk mengecek passwordnya
root@syslog01:~# kubectl get secrets -n elasticstack
NAME TYPE DATA AGE
es-7-16-3-es-elastic-user Opaque 1 80m
es-7-16-3-es-es-node-es-config Opaque 1 80m
es-7-16-3-es-es-node-es-transport-certs Opaque 5 80m
es-7-16-3-es-http-ca-internal Opaque 2 80m
es-7-16-3-es-http-certs-internal Opaque 3 80m
es-7-16-3-es-http-certs-public Opaque 2 80m
es-7-16-3-es-internal-users Opaque 5 80m
es-7-16-3-es-remote-ca Opaque 1 80m
es-7-16-3-es-transport-ca-internal Opaque 2 80m
es-7-16-3-es-transport-certs-public Opaque 1 80m
es-7-16-3-es-xpack-file-realm Opaque 4 80m
root@syslog01:~#
root@syslog01:~# kubectl get secret es-7-16-3-es-elastic-user -o=jsonpath='{.data.elastic}' -n elasticstack | base64 --decode
cL6xgdsu5490R64HTg60FYR1DT
root@syslog01:~#root@syslog01:~# cat <<EOF | kubectl apply -f -
apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
name: kibana
namespace: elasticstack
spec:
version: 7.17.23
count: 1
elasticsearchRef:
name: es-7-17-23
EOF
kibana.kibana.k8s.elastic.co/kibana created
root@syslog01:~#apiVersion: v1
kind: Service
metadata:
name: kibana-loadbalancer
namespace: elasticstack
spec:
type: LoadBalancer
ports:
- port: 5601
targetPort: 5601
protocol: TCP
selector:
kibana.k8s.elastic.co/name: kibana