【问题标题】:kubectl (node:7) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future versionkubectl (node:7) [MONGODB DRIVER] 警告:当前的服务器发现和监控引擎已被弃用,将在未来版本中删除
【发布时间】:2022-01-04 21:13:40
【问题描述】:

尝试通过演练在 kubernetes 中制作应用程序 Docker 和 Kubernetes - 初学者完整课程 https://www.youtube.com/watch?v=Wf2eSG3owoA&t=14992s&ab_channel=freeCodeCamp.org

在命令之后:

wendel@wendel-VirtualBox:~/Docker-Kub-MongoDB$ kubectl apply -f mongo-configmap.yaml
configmap/mongodb-configmap created

    wendel@wendel-VirtualBox:~/Docker-Kub-MongoDB$ kubectl apply -f mongo-express.yaml
    deployment.apps/mongo-express created
    
    wendel@wendel-VirtualBox:~/Docker-Kub-MongoDB$ kubectl logs mongo-express-78fcf796b8-t9lqj
    Welcome to mongo-express
    ------------------------
    (...)
    (node:7) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, 
and will be removed in a future version. 
To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } 
to the MongoClient constructor.

Mongo Express server listening at http://0.0.0.0:8081
Server is open to allow connections from anyone (0.0.0.0)
basicAuth credentials are "admin:pass", it is recommended you change this in your config.js!

yaml列表:

https://gitlab.com/nanuchi/youtube-tutorial-series/-/blob/master/demo-kubernetes-components/mongo-configmap.yaml

https://gitlab.com/nanuchi/youtube-tutorial-series/-/blob/master/demo-kubernetes-components/mongo-express.yaml

https://gitlab.com/nanuchi/youtube-tutorial-series/-/blob/master/demo-kubernetes-components/mongo-secret.yaml

https://gitlab.com/nanuchi/youtube-tutorial-series/-/blob/master/demo-kubernetes-components/mongo.yaml

我错过了什么来显示此警告消息?

【问题讨论】:

标签: mongodb kubernetes nodes kubectl


【解决方案1】:

此警告消息与 k8s 无关。这与用于 mongodb 服务器发现的 js 驱动程序的更改有关。在您实例化 mongodb 客户端的代码中,您应该指定警告消息中建议的标志:

const driver = MongoClient(<connection string>, { useUnifiedTopology: true })

警告应该会消失。

【讨论】:

    猜你喜欢
    • 2020-02-22
    • 2020-05-12
    • 2020-04-26
    • 2020-01-13
    • 2019-04-28
    • 1970-01-01
    • 1970-01-01
    • 2021-04-12
    • 2023-04-04
    相关资源
    最近更新 更多