Skip to content

Deploy MongoDB with Persistent Volume and expose port

Notifications You must be signed in to change notification settings

abhishekjalan87/mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Deploy mongodb on Kubernetes environment

kubectl create -f mongo-deployment.yaml

once you deploy mongodb, please follow the below steps.

  1. create user account Type in the MongoDB query below to create the new administrator user: #kubectl get pods NAME READY STATUS RESTARTS AGE mongo-controller-r8952 1/1 Running 0 21h

#kubectl exec -it mongo-controller-r8952 /bin/bash #mongo

db.createUser( { user: "admin", pwd: "admin123", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] } )

quit

  1. modify mongo.conf file - allow all IP to access mongodb from remote machine (depends on your requirement) #kubectl get pods NAME READY STATUS RESTARTS AGE mongo-controller-r8952 1/1 Running 0 21h

#kubectl exec -it mongo-controller-r8952 /bin/bash #vim /etc/mongod.conf.orig net: port: 27017 bindIp: 0.0.0.0

save and exit from pod

About

Deploy MongoDB with Persistent Volume and expose port

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published