我有一个使用分片的正在运行的 mongodb。我已经提供了我需要的所有服务,并且我有 mongodb uri 可以连接到 mongos 路由器。现在我想使用 restheart 容器来处理 http 请求。我试过这个:
apiVersion: apps/v1
kind: Deployment
metadata:
name: restheart
labels:
app: restheart
spec:
replicas: 1
selector:
matchLabels:
app: restheart
template:
metadata:
labels:
app: restheart
spec:
containers:
- name: restheart-demo
image: softinstigate/restheart
#command:
#- "--envFile /opt/restheart/etc/default.properties"
ports:
- containerPort: 8080
protocol: TCP
env:
- name: MONGO_URI
value: "mongodb://(uri here)"
然后我用:
kubectl expose deploy restheart --port 8080 --type NodePort
但获取请求返回 401 代码。我必须在这里提一下,在我的 mongo uri 中,我还包含了用户名:密码,因此 restheart 不需要进行身份验证。如何在我的 yaml 中更改 restheart 的默认设置,以便我可以正确使用它。在 kubernetes 上运行的 restheart 根本没有文档我的问题是我不知道在使用 yaml 文件构建部署时如何配置 restheart