Thanks a lotttt sir! I was struggling since 2 weeks for this code, tried multiple GPT tools as well, but couldnt help. Your video and code is a One Stop solution for all my StatefulSets and Mongodb issues. Thank you thank you thank you very much!!!
This content is amazing! You're so good at explaining and demo'ing. This helped me understand so much I did not fully grasp before. We need more in-depth content like this
@@PavanElthepu Hey small doubt hope you could reply to this, how do we connect to the mongo compass from this replicaset, i tried the same method as the deployment, but it didnt work, hoping you could clarify this? Thanks
@@PavanElthepu yes i'm justing completing the playlist, since tomorrow there is an interview just referring all your video thank you so much for your clear explanation of concepts
The explanation was very clear but I have a little problem, can you help me please? The first pod is created successfully, but at athe second pod I get the following message: Warning FailedScheduling 3m35s default-scheduler 0/1 nodes are available: pod has unbound immediate PersistentVolumeClaims. preemption: 0/1 nodes are available: 1 No preemption victims found for incoming pod.. Normal NotTriggerScaleUp 2m46s cluster-autoscaler pod didn't trigger scale-up:
Superb k8s series Pavan. Simple, crisp and clear with the content. I am following your series with handson. and all are working as you explained in videos. I shared your videos with my friends. I wish you to make more such videos and become popular in youtube with good growth. May i know your plan for the next series.? God bless you !!!
Thanks for the love Raghu Vardhan. These words really motivates me to create so much of content. Yeah, plan Git, GitOps, ArgoCD, Terraform, General Software Development/Design concepts, Kafka, Redis, SpringBoot, and many more. This would be a FullStack channel, not just DevOps!
@@PavanElthepu Superb Pavan. thanks for the headsup. i have subscribed your channel. by the way when i execute the comman "k exec -it mongo-0 -- mongo ". I am getting below error. OCI runtime exec failed: exec failed: unable to start container process: exec: "mongo": executable file not found in $PATH: unknown How to resolve this error. Can you please tell me Pavan. GOD BLESS YOU !!!
Thanks a mil Pavan. A quick question. How to automate the manual efforts that are involved, like adding the replicas details to the primary pod always when the pod re-schedules or enabling the secondary pod to allow read operations when ever the pods are scaled ?
Hello Pavan, Many thanks for sharing your knowledge. :) I just have a question, how can I connect to my mongo db cluster outside of the Kubernetes? Using a Mongo GUI like Compass. Can you help? Thank you.
very good video, most helpful one. Now can you please tell me how can I connect via mongodb compass to the mongodb database that has this statefulset setup in GKE
Thanks a mil Pavan. Just a quick question. do we have to always manually configure the secondary nodes to accept read requests when we scale up the pods ? or adding replica details manually to the primary pod if the pod rescheduled? what is the other way to get these manual process automated ?
Hi Pavan, In non-Statefulsets Mongo pod with 4 replication factor. While user fetching the query in mongo db, how the services select which pod to select the data to the user. How it select which pod to select? Could you please explain it briefly. Thank You.
Hi This video is really awesome which made our lives easy...when try to deploy the statefulset with above scripts, we getting below error here.. We have used the same files in the repo for secrets,sc,pv,pvc and config.. default-scheduler 0/1 nodes are available: pod has unbound immediate PersistentVolumeClaims. preemption: 0/1 nodes are available: 1 No preemption victims found for incoming pod.. Normal Scheduled 98s default-scheduler Successfully assigned default/mongo-0 to minikube Warning FailedMount 66s (x7 over 98s) kubelet MountVolume.SetUp failed for volume "mongodb-config" : configmap "mongodb-config" not found Normal Pulling 33s kubelet Pulling image "mongo:4.0.8".. I any information will be helpful..
Hi Pavan.. Thanks for your time. can we create a mongodb instance with single replicaset .will that serves our purpose for read & write operations...How we need to do the replica setup for single pod..?
hello, first thank you very much for this simple tutorial is clear. I have a question, and I hope you can help me with this problem. when i deploy mongodb with statefulsets , and i have deploy my server side , express js with deploy . in this case i have a primitive and secondary db. how i can conect mongodb your express so i can write in primitive and read from secondary db . in this pon where i am blocked, can you help me please
Hello Pavan, getting error after statefulsets deployed with mango-0 "exec failed: container_linux.go:380: starting container process caused: exec: \"mongo\": executable file not found in $PATH"" - can you help to throw some light.
@@PavanElthepu Thank you for quick reply Pavan. I'm good with image:4.0.8 no issues as you mentioned in your yaml file, where as if I use latest image, can you do post for latest image
Suppose we are creating a DB using StatefulSet object and we have masterNode-0 and slaveNode-1/2. If masterNode-0 goes down, will any slaveNode become master node or the whole service will stop responding to incoming request until masterNode comes-up?
If the Master Node goes down an election is held between the secondary nodes and new Primary node is elected. Also if the failed primary node recreates and comes back it becomes a secondary node.
Yes, you can use a Deployment instead of a StatefulSet to deploy a single replica of MongoDB. However, there are some important differences between the two that you should consider before making a decision. A StatefulSet is typically used when you need to manage stateful applications that require stable, unique network identities and persistent storage. MongoDB is a stateful application, and using a StatefulSet ensures that each replica has a unique identity and that data is stored persistently. On the other hand, a Deployment is typically used for stateless applications that can be scaled horizontally. MongoDB can also be deployed in a stateless manner, with a single replica running in a container, and a Deployment can be used for this purpose. Using a StatefulSet for a single MongoDB replica provides some benefits, such as: Unique network identity: Each replica will have a unique hostname that can be used to communicate with it, even if the replica is restarted. Persistent storage: Each replica will have its own persistent volume, which ensures that data is retained even if the replica is restarted or moved to a different node. Ordered startup and shutdown: StatefulSets ensure that replicas are started and stopped in a specific order, which can be important for stateful applications. However, if you only need a single MongoDB replica and do not require these benefits, a Deployment can be used instead. It is simpler to set up and manage, and can still be scaled horizontally if needed in the future.
Hi @PavanElthepu, Your videos are amazing they are very simple to understand. I have a question with the example you have shared in the statefulset.yaml file in the GitHub repo. If I have to mount mongodb.conf file under same /data/db under mongo-volume volumemount how do I do it.
1 Question : You said replication of data is not enabled by default . so if I scale the statefulset to one more pod , do I need to run the rs.initiate{} command again in the master pods with the dns of the new pod ??
@@PavanElthepu Follow-up question. The fact that you need to exec specifically into a pod to run some commands and initiate the "replication/synchronization". Does that mean that things need to be redone (exec + scripts) every time when some pods go down and reboots (because the IP will change and all that)? This would defeat this auto-repair property of Kubernetes.
Great explanation pavan.. i tried the demo but i am unable to create replication. I am getting below error: rs.initiate( { _id: "rs0", members: [ { _id: 0, host: "mongo-0.mongo.default.svc.cluster.local:27017" }, { _id: 1, host: "mongo-1.mongo.default.svc.cluster.local:27017" }, { _id: 2, host: "mongo-2.mongo.default.svc.cluster.local:27017" } ] } ) { "operationTime" : Timestamp(0, 0), "ok" : 0, "errmsg" : "No host described in new configuration 1 for replica set rs0 maps to this node", "code" : 93, "codeName" : "InvalidReplicaSetConfig", "$clusterTime" : { "clusterTime" : Timestamp(0, 0), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } } could you please check and let me know what might be the issue ? Thanks !!!
now 2023: i meet issue about init primary node and secondary node "errmsg" : "replSetInitiate quorum check failed because not all proposed set members responded affirmatively: mongo-1.mongo.mongodb.svc.cluster.local:27017 failed with Couldn't get a connection within the time limit", "code" : 74, "codeName" : "NodeNotFound", i need help