Statefulsets | Deploying MongoDB cluster to Kubernetes

  Рет қаралды 23,651

Pavan Elthepu

Pavan Elthepu

Күн бұрын

In this video, we'll learn:
1. Differences between Stateless and Stateful applications
2. What problems a Statefulset solves
3. Where to use Headless Services
4. Differences between Deployment and Statefulset
5. How to deploy a Stateful application with multiple replicas using Statefulsets with complete hands-on
Manifests: github.com/pelthepu/Kubernete...
Please give a Like and Subscribe - bit.ly/pavanelthepu
Timestamps:
0:00 - Intro
00:42 - Differences between Stateless and Stateful applications
2:17 - What problems a Statefulset solves
6:55 - Headless Services
8:14 - Differences between Deployment and Statefulset
9:15 - How to deploy a Stateful application with multiple replicas using Statefulsets
My other courses:
Docker Complete Course: • Docker Tutorial | Ful...
Thank you very much!
#kubernetes #statefulsets #fullstackdevelopment #devops

Пікірлер: 120
@naveenchebolu6757
@naveenchebolu6757 2 күн бұрын
This video clears all my doubts about statefulsets .Why this video not went viral.
@kaykay02120
@kaykay02120 3 ай бұрын
no one can give better explanation than this. kudos to you pavan
@dipi411
@dipi411 3 ай бұрын
Nice !Duration is short but every aspect of stateful set has been covered.
@saikrishnareddybandi8285
@saikrishnareddybandi8285 11 ай бұрын
Ultimate level of teaching 🙏🙏🙏
@vishalmishra176
@vishalmishra176 Жыл бұрын
You kept it simple. Very helpful. Thank you.
@PavanElthepu
@PavanElthepu Жыл бұрын
Thank you Vishal. Please share it with your friends and colleagues
@ye__in
@ye__in Жыл бұрын
Amazing amazing amazing!! Most helpful K8S video so far! Thank you so much
@PavanElthepu
@PavanElthepu Жыл бұрын
Thank you so much. Please subscribe and share with your friends and colleagues
@krushnabhanage5780
@krushnabhanage5780 Жыл бұрын
You made it easy to understand, was really helpful. Keep up!!!!
@PavanElthepu
@PavanElthepu Жыл бұрын
Glad that it helped you Krushna. Please share with your friends and colleagues
@janvidalal476
@janvidalal476 4 ай бұрын
Your videos are GOLD!! 🎉
@PavanElthepu
@PavanElthepu 4 ай бұрын
Thank you so much🙂. Please share with your friends and colleagues
@umeshsaini3109
@umeshsaini3109 10 ай бұрын
Again appreciated bro!! You have explained everything in detail. I wish I could have come on this channel earlier.
@PavanElthepu
@PavanElthepu 10 ай бұрын
Please connect with me on LinkedIn
@neeharikagv2812
@neeharikagv2812 Жыл бұрын
This is so helpful. Concept and practicals in single video from end to end is amazing. Thank you so so much
@PavanElthepu
@PavanElthepu Жыл бұрын
Love to hear that😊
@chfr
@chfr Жыл бұрын
Good video, it explains the intricacies of stateful sets and headless services very well.
@PavanElthepu
@PavanElthepu Жыл бұрын
Thank you so much. Please share with your friends and colleagues
@kreebo_
@kreebo_ Жыл бұрын
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
@PavanElthepu Жыл бұрын
Thank you so much Cheslyn. Please subscribe and share with your friends and colleagues
@liontechnologiessolutions8755
@liontechnologiessolutions8755 11 ай бұрын
​@@PavanElthepuI could get you a tutoring job. For about 6 hours a week. Please get in touch
@vitusyu9583
@vitusyu9583 3 ай бұрын
Your presentation is clear and yet comprehensive. Thanks! I just subscribed to your channel to watch more on K8.
@PavanElthepu
@PavanElthepu 3 ай бұрын
Thank you so much. Please share with your friends and colleagues🙏
@TC-kt7pp
@TC-kt7pp 6 ай бұрын
Thank you this video helped me a lot, in fact you're all videos are great to understand easily.
@PavanElthepu
@PavanElthepu 6 ай бұрын
Thank you so much. Please subscribe and share with your friends and colleagues
@aayush5474
@aayush5474 10 ай бұрын
Your channel has best kubernetes tutorials. Thanks a lot for this
@PavanElthepu
@PavanElthepu 10 ай бұрын
Thank you so much Ayush. Please subscribe and share with your friends and colleagues
@jalandharbehera2456
@jalandharbehera2456 Жыл бұрын
Really sir....no words for you 🙏🙏 I already have share your most the videos because all should know you and your channel and that helps them most 🙏🙏🙏
@PavanElthepu
@PavanElthepu Жыл бұрын
Thank you so much Jalandhar for your love🙏
@HarshaVardhan-mr2bw
@HarshaVardhan-mr2bw 11 ай бұрын
was searching for this kind of video, thanks man, crystal clear from point to point, amazing, keep posting this content.
@PavanElthepu
@PavanElthepu 11 ай бұрын
Thank you so much HarshaVardhan. Please subscribe and share with your friends and colleagues
@HarshaVardhan-mr2bw
@HarshaVardhan-mr2bw 11 ай бұрын
@@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
@cloudpillsdaily
@cloudpillsdaily 4 ай бұрын
more than gold thank you so much
@sagarasgr
@sagarasgr 6 ай бұрын
Great tutorial 💯
@ruptamsadhukhan7834
@ruptamsadhukhan7834 8 ай бұрын
Hey Pavan, Nice Explanation!!! I need to implement this using postgres.
@PavanElthepu
@PavanElthepu 8 ай бұрын
Yes, you can use same concept with PostgreSQL
@jyothsnabethavalli9599
@jyothsnabethavalli9599 11 ай бұрын
Great tutorial
@dummymail6029
@dummymail6029 2 ай бұрын
great video thanks pavan :)
@PavanElthepu
@PavanElthepu 2 ай бұрын
Looks like you are watching all my videos today🙂. I have received your comments on many videos
@dummymail6029
@dummymail6029 2 ай бұрын
@@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
@taiz2908
@taiz2908 Жыл бұрын
Nice explanation 👌🏻 Waiting for you to upload more videos
@PavanElthepu
@PavanElthepu Жыл бұрын
Thanks you Taizun. Please share it with your colleagues and friends
@taiz2908
@taiz2908 Жыл бұрын
@@PavanElthepu sure..
@eugenmalatov5470
@eugenmalatov5470 11 ай бұрын
Really amazing, thanks a lot!
@PavanElthepu
@PavanElthepu 11 ай бұрын
Thank you so much, please subscribe and share with your friends and colleagues
@pavankongara792
@pavankongara792 Жыл бұрын
amazing!
@raghuvardhansaripalli9636
@raghuvardhansaripalli9636 Жыл бұрын
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 !!!
@PavanElthepu
@PavanElthepu Жыл бұрын
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!
@raghuvardhansaripalli9636
@raghuvardhansaripalli9636 Жыл бұрын
@@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 !!!
@Mohammed-co3ux
@Mohammed-co3ux Жыл бұрын
Hey buddy I have been into devops for quite some time now. This video is a gateway for many who make it hard to understand statefulset.. Way to go..
@t.bikash62
@t.bikash62 3 ай бұрын
9 mins and straight searched the subscribe button!
@PavanElthepu
@PavanElthepu 3 ай бұрын
Means a lot. Please share with all your friends and colleagues
@yashkinra7033
@yashkinra7033 11 ай бұрын
loved it
@navyabhanuchaganti6718
@navyabhanuchaganti6718 11 ай бұрын
Nice explanation wid figure 👍
@PavanElthepu
@PavanElthepu 11 ай бұрын
Thank you Navya. Please subscribe and share with your friends and colleagues
@maheshkumarnaik754
@maheshkumarnaik754 6 ай бұрын
Nice sir
@PavanElthepu
@PavanElthepu 6 ай бұрын
Thank you Mahesh. Please subscribe and share with your friends and colleagues
@abhinavkumar2099
@abhinavkumar2099 Жыл бұрын
superb
@PavanElthepu
@PavanElthepu Жыл бұрын
Thank you Abhinav. Please share with your friends and colleagues
@walkerstark9584
@walkerstark9584 11 ай бұрын
😭😭😭😭😭😭😭😭😭 You're the Best bro
@PavanElthepu
@PavanElthepu 11 ай бұрын
Ha ha🙂. Thank you so much. Please subscribe and share with your friends and colleagues
@walkerstark9584
@walkerstark9584 11 ай бұрын
@@PavanElthepu Done
@marcikaist
@marcikaist Жыл бұрын
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:
@sivakrishna-hk2un
@sivakrishna-hk2un 11 ай бұрын
requesting you to Please make videos on kubernetes troubleshooting means errors and their solutions
@PavanElthepu
@PavanElthepu 11 ай бұрын
Sire Siva Krishna
@user-zo3rj5xk8z
@user-zo3rj5xk8z 2 ай бұрын
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 ?
@mrnikhil4898
@mrnikhil4898 Жыл бұрын
Hi Sir, Can the replication algorithm mentioned in the video be applied for mysql pods?
@thangapandianm7862
@thangapandianm7862 2 ай бұрын
Thanks Pavan. it's really helpful. if I need to restart the mongoDB password then what should I do.
@user-zo3rj5xk8z
@user-zo3rj5xk8z 2 ай бұрын
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 ?
@gokhunyayla
@gokhunyayla 10 ай бұрын
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
@manasas9671
@manasas9671 8 ай бұрын
Thank you for the video, How can we configure master and slave in Mysql Database
@andrevieira997
@andrevieira997 5 ай бұрын
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.
@rajangarg
@rajangarg Жыл бұрын
Thanks for the simplified explanation. I want to know is there any other condition apart from authentication which can make an application stateful?
@PavanElthepu
@PavanElthepu Жыл бұрын
Doesn't matter, anything that you store for future usage makes an application Stateful. Examples: Redis, all DBs, all message brokers, etc..
@SusmithaNikhil
@SusmithaNikhil 10 ай бұрын
how do we configure the mongocompass to access the replicaset from internet
@rajeshdheenan9913
@rajeshdheenan9913 6 ай бұрын
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.
@rahulpardeshi56
@rahulpardeshi56 6 ай бұрын
How to take backup of DB deployed using Statefulsets in K8s CLuster??
@jyothsnabethavalli9599
@jyothsnabethavalli9599 11 ай бұрын
Any video on mysql data replication please help and share any link please
@developershourov4390
@developershourov4390 Ай бұрын
how to expose this for mongodb compass?
@parimalaprao
@parimalaprao Ай бұрын
Can you please make a tutorial on k8s certificates?? Why, how and when of those certificates?
@swapnilgawade9048
@swapnilgawade9048 Жыл бұрын
Its very helpful, thank you!! Can you please share the link of manifest files?
@PavanElthepu
@PavanElthepu Жыл бұрын
Updated the description with manifest link Swapnil. Glad that it helped you, kindly share the video with your colleagues and friends.
@thiagoacsoares
@thiagoacsoares 9 ай бұрын
Good evening, access to mongodb is occurring without a password. mongodb is not asking for username and password.
@najibiziki4070
@najibiziki4070 Жыл бұрын
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
@PavanElthepu
@PavanElthepu Жыл бұрын
Hi Najib, you can give read preference in connection string or in your code while doing database operations.
@bharath4195
@bharath4195 Жыл бұрын
what do you suggest deployment or statefulset ?
@PavanElthepu
@PavanElthepu Жыл бұрын
I depends on your application. If you’re storing any state, the go for statefulset. If there is no state needed, go with deployment
@himaniupadhyay4u
@himaniupadhyay4u 8 ай бұрын
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?
@harshupadhyay2032
@harshupadhyay2032 7 ай бұрын
Have you got the answer, because I too am searching for the same
@denkoech8712
@denkoech8712 Жыл бұрын
how do you replication automatically if you have enabled HPA?
@PavanElthepu
@PavanElthepu Жыл бұрын
There are multiple ways of doing this like using Operator, adding a sidecar container, etc..
@ShourovRoy-pk5zm
@ShourovRoy-pk5zm Ай бұрын
Not working. And how to access from external?
@jitendernegi9074
@jitendernegi9074 Жыл бұрын
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
@PavanElthepu Жыл бұрын
Yes. There are multiple ways of doing this like using Operator, adding a sidecar container, etc..
@jitendernegi9074
@jitendernegi9074 Жыл бұрын
@@PavanElthepu thanks for the prompt response . The video is really very informative
@PavanElthepu
@PavanElthepu Жыл бұрын
Thank you Jitender. Please subscribe and share with your friends and colleagues
@eugenmalatov5470
@eugenmalatov5470 11 ай бұрын
@@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.
@PavanElthepu
@PavanElthepu 11 ай бұрын
It doesn't, as that script execution is automated on every pod creation
@roopesh668
@roopesh668 Жыл бұрын
So, If 1 replica of mongodb is enough then the kind of Deployment is enough right?
@PavanElthepu
@PavanElthepu Жыл бұрын
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.
@HarshaVardhan-mr2bw
@HarshaVardhan-mr2bw 11 ай бұрын
Hi, can anyone guide me to connect this statefulset replicaset to the mongo compass. Thank you
@PavanElthepu
@PavanElthepu 11 ай бұрын
Hi Harsha, you mean you want to connect to statefulset from Mongo compass?
@HarshaVardhan-mr2bw
@HarshaVardhan-mr2bw 11 ай бұрын
@@PavanElthepu yes
@PavanElthepu
@PavanElthepu 11 ай бұрын
Watch my jobs and cronjobs video. There I gave the connection uri. You may use it from Mongo Compass
@chennareddy2770
@chennareddy2770 9 ай бұрын
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.
@subbareddyjangalapalli6310
@subbareddyjangalapalli6310 7 ай бұрын
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
@PavanElthepu 7 ай бұрын
Did you use same manifest?
@subbareddyjangalapalli6310
@subbareddyjangalapalli6310 7 ай бұрын
@@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
@PavanElthepu
@PavanElthepu 7 ай бұрын
@@subbareddyjangalapalli6310 sure, I'll try
@sriramakrishnas9248
@sriramakrishnas9248 Жыл бұрын
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..
@PavanElthepu
@PavanElthepu Жыл бұрын
Thank you Sri Rama Krishna. It’s saying that configmap not found
@sriramakrishnas9248
@sriramakrishnas9248 Жыл бұрын
@@PavanElthepu Thanks Pavan..
@sriramakrishnas9248
@sriramakrishnas9248 Жыл бұрын
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..?
@siddharthgaur6854
@siddharthgaur6854 Жыл бұрын
@pavan: How to self host typesense on K8 cluster using deployment.yaml
@PavanElthepu
@PavanElthepu Жыл бұрын
Typesense should be deployed using Statefulset as it’s a stateful application.
@nihalahmed6302
@nihalahmed6302 2 ай бұрын
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 !!!
@vuat1494
@vuat1494 7 ай бұрын
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
ConfigMaps and Secrets in Kubernetes
16:35
Pavan Elthepu
Рет қаралды 10 М.
Kubernetes Volumes Simplified
39:37
Pavan Elthepu
Рет қаралды 29 М.
🍟Best French Fries Homemade #cooking #shorts
00:42
BANKII
Рет қаралды 59 МЛН
Заметили?
00:11
Double Bubble
Рет қаралды 3,6 МЛН
La revancha 😱
00:55
Juan De Dios Pantoja 2
Рет қаралды 35 МЛН
When Steve And His Dog Don'T Give Away To Each Other 😂️
00:21
BigSchool
Рет қаралды 17 МЛН
Kubernetes StatefulSet simply explained | Deployment vs StatefulSet
16:00
TechWorld with Nana
Рет қаралды 223 М.
Kubernetes Ingress networking
5:57
Project Calico
Рет қаралды 47 М.
Kubernetes Ingress
26:56
Pavan Elthepu
Рет қаралды 32 М.
Statefulset for deploying database in Kubernetes
22:21
Houssem Dellai
Рет қаралды 4,3 М.
Do NOT Learn Kubernetes Without Knowing These Concepts...
13:01
Travis Media
Рет қаралды 228 М.
Kubernetes Deployment vs. StatefulSet vs. DaemonSet
6:43
Anton Putra
Рет қаралды 32 М.
Should We Run Databases In Kubernetes? CloudNativePG (CNPG) PostgreSQL
19:10
Setup MongoDB for Production deployment - Replica Sets cluster
19:42
🍟Best French Fries Homemade #cooking #shorts
00:42
BANKII
Рет қаралды 59 МЛН