在Minikube部署K8s Addons版ELK遇Kibana未就绪及ES异常求助
Hey there, let’s work through this ELK deployment issue you’re hitting in Minikube. That exit code 137 on your elasticsearch-logging-0 pod is the key hint here—it almost always means the pod was killed by the kernel because it ran out of memory (OOMKilled). Minikube’s default resource limits are usually too tight for Elasticsearch, which is pretty memory-hungry. Here’s how to fix this step by step:
1. Boost Minikube’s Memory Allocation
Minikube typically starts with only 2GB of memory, which isn’t enough for Elasticsearch + Kibana + Fluentd. Let’s bump it up:
- First, check your current Minikube memory setting:
minikube config get memory - If it’s less than 4GB, stop and restart Minikube with more resources (4GB is the minimum, 6GB is even better):
minikube stop && minikube delete && minikube start --memory=4096 --cpus=2
2. Add Resource Limits to Elasticsearch
The official fluentd-elasticsearch addon YAMLs often don’t set proper resource requests/limits for Elasticsearch, letting it hog too much memory. Edit your elasticsearch-logging.yaml file:
- Find the
spec.template.spec.containerssection for theelasticsearchcontainer, then add these resource constraints (adjust based on your Minikube memory):resources: requests: memory: "1Gi" cpu: "500m" limits: memory: "2Gi" cpu: "1"
This ensures Elasticsearch doesn’t eat up all available node memory, preventing OOM kills.
3. Redeploy the ELK Stack
Delete your existing deployment and reapply the modified YAMLs:
kubectl delete -f fluentd-elasticsearch/ kubectl create -f fluentd-elasticsearch/
4. Verify Elasticsearch Health
Wait a minute or two for the pods to restart, then check their status:
kubectl get pods -n kube-system | grep elasticsearch
Once the pod shows Running without restarts, grab the Elasticsearch service’s cluster IP:
kubectl get svc -n kube-system elasticsearch-logging
SSH into Minikube and test connectivity again:
curl <your-es-cluster-ip>:9200
You should get a JSON response with Elasticsearch’s cluster details if it’s working.
5. Check Kibana Again
Once Elasticsearch is healthy, Kibana will automatically connect to it. Give it 2-3 minutes to finish initializing, then refresh minikube-ip:30345—the "Kibana server is not ready yet" message should be gone.
Extra Troubleshooting Tips
- If you still see issues, check the Elasticsearch pod logs for more clues:
kubectl logs elasticsearch-logging-0 -n kube-system - Verify your Minikube node has enough free resources:
kubectl describe nodes minikube
Look at the Allocatable and Used sections under Capacity to confirm memory isn’t maxed out.
内容的提问来源于stack exchange,提问作者Rosmee

