Search code examples
mongodbmongoosekuberneteskubectlrockmongo

How I can use MongoDB GUI tool like mongo-express or RockMongo on Kubernetes cluster


I have MongoDB running on Kuberenetes cluster and I am looking for a MongoDB GUI tool like PHPmyAdmin to run it as a pod on the cluster and , I have Rockmongo running as a pod but it doesn't connect to MongoDB and also I couldn't expose it, I need any microservice i can run on kubernetes cluster that can do administration for MongoDB pod that is running on default namespace as well.

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: rockmongo
spec:
  selector:
    matchLabels:
      app: rockmongo
   replicas: 1
   template:
    metadata:
     labels:
    app: rockmongo
spec:
  containers:
  - name: rockmongo
    image: webts/rockmongo
    ports:
    - containerPort: 8050
    env:
    - name: MONGO_HOSTS
      value: '27017'
    - name: ROCKMONGO_PORT
      value: '8050'
    - name: MONGO_HIDE_SYSTEM_COLLECTIONS
      value: 'false'
    - name: MONGO_AUTH
      value: 'false'
    - name: ROCKMONGO_USER
      value: 'admin'
    - name: ROCKMONGO_PASSWORD
      value: 'admin'

Services running on the cluster

rockmongo                  ClusterIP      10.107.52.82    <none>           8050/TCP                        13s

Solution

  • As Vishal Biyani suggested, you may consider using Kubernetes ingress (with ingress controller) to access internal resources of MongoDB or GUI for PHP operations. Distributed databases such as MongoDB require a little extra attention when being deployed with orchestration frameworks such as Kubernetes.

    I found interesting documentation regarding your needs of MongoDB as a microservice with docker and Kubernetes.