Files
feedc0de df3743c9dc
Validate and deploy Elastic Stack / Validate manifests (push) Successful in 13s
Validate and deploy Elastic Stack / Deploy to Kubernetes (push) Failing after 18s
Install elastic to the cluster
2026-08-24 21:40:59 +02:00

42 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
namespace=${NAMESPACE:-elastic}
kubectl get elasticsearch,kibana,beat,agent,ingress,service,pods,pvc \
--namespace "${namespace}" --output=wide
echo
echo "Recent NetFlow collector logs:"
kubectl logs --namespace "${namespace}" \
--selector beat.k8s.elastic.co/name=netflow \
--tail=3
echo
echo "Traffic Flow records received:"
pod=$(kubectl get pods --namespace "${namespace}" \
--selector elasticsearch.k8s.elastic.co/cluster-name=elasticsearch \
--output=jsonpath='{.items[0].metadata.name}')
password=$(kubectl get secret elasticsearch-es-elastic-user \
--namespace "${namespace}" --output=go-template='{{.data.elastic | base64decode}}')
kubectl exec --namespace "${namespace}" "${pod}" -- \
curl --silent --show-error --fail \
--cacert /usr/share/elasticsearch/config/http-certs/ca.crt \
--user "elastic:${password}" \
'https://elasticsearch-es-http.elastic.svc:9200/filebeat-*/_count?q=event.dataset:netflow.log'
unset password
echo
echo
echo "Traefik access records received:"
password=$(kubectl get secret elasticsearch-es-elastic-user \
--namespace "${namespace}" --output=go-template='{{.data.elastic | base64decode}}')
kubectl exec --namespace "${namespace}" "${pod}" -- \
curl --silent --show-error --fail \
--cacert /usr/share/elasticsearch/config/http-certs/ca.crt \
--user "elastic:${password}" \
'https://elasticsearch-es-http.elastic.svc:9200/logs-traefik.access-*/_count'
unset password
echo