Elasticsearch OOMKilled 137
2025. 2. 7. 23:18ㆍk8s/EFK
오류
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: OOMKilled
Exit Code: 137
원인
Elasticsearch는 기본적으로 가용한 메모리의 50%를 jvm에 할당함
jvm 옵션이 pod의 limit를 넘어서 지정되어서 발생한 문제
apiVersion: apps/v1
kind: Deployment
metadata:
name: elasticsearch
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: elasticsearch
template:
metadata:
labels:
app: elasticsearch
spec:
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.1
env:
# ✅ Set JVM Heap Size via Environment Variables
- name: ES_JAVA_OPTS
value: "-Xms5g -Xmx5g" # ✅ Set both min and max heap size to 2GB
resources:
requests:
memory: "2Gi" # Minimum memory request
cpu: "500m"
limits:
memory: "4Gi" # Maximum memory limit
cpu: "1"
ports:
- containerPort: 9200
volumeMounts:
- name: elasticsearch-data
mountPath: /usr/share/elasticsearch/data
volumes:
- name: elasticsearch-data
emptyDir: {} # Use a PersistentVolumeClaim (PVC) for production
조치
env:
# ✅ Set JVM Heap Size via Environment Variables
- name: ES_JAVA_OPTS
value: "-XX:MaxRAMPercentage=75" # ✅ Set both min and max heap size to 2GB
'k8s > EFK' 카테고리의 다른 글
Metricbeat Pod로 Elasticsearch와 연동하기 (0) | 2025.02.08 |
---|---|
Metricbeat /usr/local/bin/docker-entrypoint: line 8: exec: metricbeat: not found (0) | 2025.02.08 |
Kibana FATAL Error: [config validation of [elasticsearch].apiKey]: definition for this key is missing (0) | 2025.02.07 |
Elasticsearch 버전 확인 (0) | 2025.02.07 |
Fluentd elasticsearch와 연결이 끊어질 때, buffer 설정 (0) | 2025.02.07 |