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

wf82jlnq  于 2022-12-26  发布在  Kubernetes
关注(0)|答案(3)|浏览(522)

我正在尝试将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!

有人知道该怎么做吗?

vh0rcniy

vh0rcniy1#

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

image: mongo:4.4.6

参考:
Mongo 5.0.0 crashes but 4.4.6 works #485

dw1jzc5e

dw1jzc5e2#

无需AVX即可运行的最新版本是

image: mongo:4.4.18

但如果你是在VPS上使用它,值得一试联系他们的支持,我的说他们改变了CPU类型,解决了这个问题。

68bkxrlz

68bkxrlz3#

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

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

可能需要重新启动主机。

相关问题