Area: Deployment
Sub-Area: Infrastructure
Applies to: OSS
Issue
DataHub pods (GMS, frontend, consumers) crash, restart often, or sit in CrashLoopBackOff. You may also see OOMKilled or ImagePullBackOff in the pod status.
These steps apply to self-hosted DataHub on Kubernetes, installed with the DataHub Helm charts. DataHub Cloud customers have no kubectl access to DataHub pods and can't change Helm values or environment variables. If you use DataHub Cloud, contact DataHub Support.
You Might Be Asking
- Why do my DataHub pods keep restarting?
- How do I raise the memory or heap for GMS, the frontend or search?
- How do I troubleshoot pod crashes?
Cause
The most common causes are:
- A container that runs out of memory and is killed (
OOMKilled). - A JVM heap that doesn't fit the container's memory limit.
- A dependency that isn't running, such as MySQL, Kafka or the search cluster.
- Wrong database settings or a missing database secret.
Solution
1. Find the real pod names and read the events and logs
With the documented release name datahub, pods are named like datahub-datahub-gms-<hash>, datahub-datahub-frontend-<hash> and datahub-datahub-system-update-<id>. Prerequisite pods are named like prerequisites-kafka-0 and prerequisites-mysql-0. Copy the names from your own cluster and add -n <namespace> to every command.
kubectl get pods -n <namespace>
kubectl describe pod <pod-name> -n <namespace>
kubectl logs <pod-name> -n <namespace> --tail=100
kubectl logs <pod-name> -n <namespace> --previous
Use --previous to read the logs of the container that crashed.
2. Check that the prerequisites are running
In kubectl get pods, confirm the MySQL, Kafka and search pods from the prerequisites chart are Running. GMS can't start cleanly without them.
3. Check the database settings
The database is set in the sql.datasource block of the DataHub chart values: host, url, db (default datahub), username, and password.secretRef and password.secretKey. The documented install creates a secret named mysql-secrets:
kubectl create secret generic mysql-secrets --from-literal=mysql-root-password=datahub
Check that the secret named in password.secretRef exists in the namespace where you installed DataHub:
kubectl get secret mysql-secrets -n <namespace>
4. Raise resources for OOMKilled pods
Set resources for each DataHub component in your Helm values. Choose the numbers for your workload.
datahub-gms:
resources:
requests:
memory: "<amount>"
cpu: "<amount>"
limits:
memory: "<amount>"
cpu: "<amount>"
datahub-frontend:
resources:
requests:
memory: "<amount>"
cpu: "<amount>"
limits:
memory: "<amount>"
cpu: "<amount>"
5. Set JVM heap with jvmOpts
The datahub-gms, datahub-frontend and datahub-mce-consumer subcharts set JVM options with jvmOpts. Don't add a JAVA_OPTS entry under an env: list. Keep the heap below the container memory limit. Check the chart's values.yaml for the exact format.
datahub-gms:
jvmOpts: "<JVM options>"
To add other environment variables, use extraEnvs. The chart appends it to the container's env:.
6. Set search heap in the prerequisites chart
In the DataHub prerequisites chart, set Elasticsearch heap with elasticsearch.esJavaOpts (for example "-Xmx512m -Xms512m"). Set OpenSearch heap with opensearch.opensearchJavaOpts. In the current prerequisites chart, Elasticsearch is disabled and OpenSearch is enabled. A bare ES_JAVA_OPTS env block is not the chart's setting.
7. Apply the change
Apply your values with helm upgrade. This runs the system-update Job as a pre-upgrade hook and again as a post-upgrade hook. If your pipeline applies helm template output with kubectl, Kustomize or Spinnaker, those hooks don't run.