Mongo DB 部署在 kubernetes 中不起作用,因为处理器不支持 AVX

我正在尝试将 mongo db 部署与服务一起部署,如下所示:

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

即使一切似乎都已正确配置和部署,但它会进入 CrashLoopBackOff 状态而不是 Running ,使用 kubectl logs <deployment-name> 我收到以下错误:

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

有人知道该怎么做吗?

stack overflow Mongo DB deployment not working in kubernetes because processor doesn't have AVX support
原文答案
author avatar

接受的答案

为了解决这个问题,我必须运行一个旧的 mongo-db docker 镜像版本(4.4.6),如下:

image: mongo:4.4.6

参考:

Mongo 5.0.0 crashes but 4.4.6 works #485


答案:

作者头像

如果您使用 Windows+VirtualBox 这将解决问题:

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

也许需要重新启动主机。