deploy Restheart at kubernetes running mongodb sharded db

233 views Asked by At

I have a running mongodb using sharding. I have made all the services i need, and i have mongodb uri to connect to mongos router. Now i want to use restheart container for http requests. I tried this:

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)"

then i used:

kubectl expose deploy restheart  --port 8080 --type NodePort

but get Requests return 401 code. I have to mention here that at my mongo uri i also included username:password, so that restheart not need to authenticate. how can i change the default settings of restheart at my yaml so that i can use it properly. There no documentation at all for restheart running at kubernetes My problem is that i dont know how to configure restheart when building my deploy with yaml file

1

There are 1 answers

4
Saurabh Nigam On

If you will check this URL.

You can see default value for mongo-uri = mongodb://127.0.0.1 You cant override this with environment variable. Instead, use volume mounts to replace that specific file with a configmap containing this file with changes and things should work.