13

I am trying to deploy a mongo db deployment together with service, as follows:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongo-deployment
  labels:
    app: mongo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongo
  template:
    metadata:
      labels:
        app: mongo
    spec:
      containers:
      - name: mongo
        image: mongo:5.0
        ports:
        - containerPort: 27017
        env:
        - name: MONGO_INITDB_ROOT_USERNAME
          valueFrom:
            secretKeyRef: 
              name: mongo-secret
              key: mongo-user
        - name: MONGO_INITDB_ROOT_PASSWORD
          valueFrom:
            secretKeyRef: 
              name: mongo-secret
              key: mongo-password
---
apiVersion: v1
kind: Service
metadata:
  name: mongo-service
spec:
  selector:
    app: mongo
  ports:
    - protocol: TCP
      port: 27017
      targetPort: 27017

Even though everything seems to be configured right and deployed, it gets to a CrashLoopBackOff state instead of Running, using a kubectl logs <deployment-name> I get the following error:

MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!

Does anybody know what to do?

pedro_bb7
  • 1,601
  • 3
  • 12
  • 28
  • Does this answer your question? [Illegal instruction (core dumped) mongodb Ubuntu 20.04 LTS](https://stackoverflow.com/questions/68937131/illegal-instruction-core-dumped-mongodb-ubuntu-20-04-lts) Full working solution. – Gilles Quénot May 19 '23 at 21:24

3 Answers3

32

To solve this issue I had to run an older mongo-db docker image version (4.4.6), as follows:

image: mongo:4.4.6

Reference:

Mongo 5.0.0 crashes but 4.4.6 works #485

pedro_bb7
  • 1,601
  • 3
  • 12
  • 28
4

The latest version that can work WITHOUT AVX is

image: mongo:4.4.18

but if you are using it on a VPS, its worth a shot to contact their support, mine said that they changed the CPU type and that fixed the problem.

Ali80
  • 6,333
  • 2
  • 43
  • 33
1

If you use Windows+VirtualBox this will resolve the issue:

bcdedit /set hypervisorlaunchtype off
DISM /Online /Disable-Feature:Microsoft-Hyper-V

perhaps host reboot required.

SeventhSon
  • 29
  • 4