0

MongoDB and Mongo-express run on minikube by docker driver. There are mongoDB config, mongoBD secret, mongo express config and mongo configmap yaml files. Services config are written on mongoDB config and mongo express config files. I can not open mongo express on web browser. curl refused as well.

mongo express yaml file:

piVersion: apps/v1
kind: Deployment
metadata:
  name: mongoex-deployment
  labels:
    app: mongoex
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongoex
  template:
    metadata:
      labels:
        app: mongoex
    spec:
      containers:
      - name: mongoex
        image: mongo-express
        ports:
          - containerPort: 8081
        env:
          - name: ME_CONFIG_MOGNODB_ADMINUSERNAME
            valueFrom:
              secretKeyRef:
                name: mongodb-secret
                key: mongo-root-username
          - name: ME_CONFIG_MONGODB_ADMINPASSWORD
            valueFrom:
              secretKeyRef:
                name: mongodb-secret
                key: mongo-root-password
          - name: ME_CONFIG_MONGODB_SERVER
            valueFrom:
              configMapKeyRef:
                name: mongo-configmap
                key: database_url

---
apiVersion: v1
kind: Service
metadata:
  name: mongoex-service
spec:
  selector:
    app: mongoex
  type: LoadBalancer
  ports:
    - protocol: TCP
      port: 8081
      targetPort: 8081


When I run kubectl service [mongo-express service] 


arallels@parallels-Parallels-Virtual-Platform:~/minikube-projects/mongo-project$ minikube service j .mongo-configmap.yaml.swp mongodb-secret.yaml mongoex-deployment.yaml
mongo-configmap.yaml mongodb-deployment.yaml .mongodb-.swp
parallels@parallels-Parallels-Virtual-Platform:~/minikube-projects/mongo-project$ minikube service

❌ Exiting due to MK_USAGE: You must specify service name(s) or --all

parallels@parallels-Parallels-Virtual-Platform:~/minikube-projects/mongo-project$ kubectl get service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 443/TCP 25h mongodb-service ClusterIP 10.102.183.17 27017/TCP 60m mongoex-service LoadBalancer 10.106.109.43 8081:32367/TCP 14m parallels@parallels-Parallels-Virtual-Platform:~/minikube-projects/mongo-project$ minikube service mongoex-service |-----------|-----------------|-------------|---------------------------| | NAMESPACE | NAME | TARGET PORT | URL | |-----------|-----------------|-------------|---------------------------| | default | mongoex-service | 8081 | http://192.168.49.2:32367 | |-----------|-----------------|-------------|---------------------------| Opening service default/mongoex-service in default browser... parallels@parallels-Parallels-Virtual-Platform:~/minikube-projects/mongo-project$ curl http://192.168.49.2:32367 curl: (7) Failed to connect to 192.168.49.2 port 32367: Connection refused parallels@parallels-Parallels-Virtual-Platform:~/minikube-projects/mongo-project$kubectl get pods NAME READY STATUS RESTARTS AGE mongodb-deployment-844789cd64-b9kj8 1/1 Running 0 61m mongoex-deployment-6966646b5f-9dz4c 1/1 Running 0 15m parallels@parallels-Parallels-Virtual-Platform:~/minikube-projects/mongo-project$ kubectl logs mongoex-deployment-6966646b5f-9dz4c Welcome to mongo-express

(node:8) [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. (node:8) UnhandledPromiseRejectionWarning: MongoError: command listDatabases requires authentication at Connection. (/node_modules/mongodb/lib/core/connection/pool.js:453:61) at Connection.emit (events.js:314:20) at processMessage (/node_modules/mongodb/lib/core/connection/connection.js:456:10) at Socket. (/node_modules/mongodb/lib/core/connection/connection.js:625:15) at Socket.emit (events.js:314:20) at addChunk (_stream_readable.js:297:12) at readableAddChunk (_stream_readable.js:272:9) at Socket.Readable.push (_stream_readable.js:213:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23) (node:8) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:8) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. parallels@parallels-Parallels-Virtual-Platform:~/minikube-projects/mongo-project$ minikube service list |-------------|-----------------|--------------|---------------------------| | NAMESPACE | NAME | TARGET PORT | URL | |-------------|-----------------|--------------|---------------------------| | default | kubernetes | No node port | | default | mongodb-service | No node port | | default | mongoex-service | 8081 | http://192.168.49.2:32367 | | kube-system | kube-dns | No node port | |-------------|-----------------|--------------|---------------------------|






Restart all pods, Minikube, Linux. Checked all info in yaml files. 
its_me
  • 1

1 Answers1

0

Thank all who tried to help me with this issue.

Ive spent plenty of time fixing this yesterday.

The latest version of Mongo-express does not work well in my environment. So I pulled image mongo-express:0.49.0. And this issue got resolved. So probably it was a software problem. But if you have some comments to write I would like to read and understand this issue deeply.

its_me
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 30 '22 at 06:54