Understanding StatefulSets in Kubernetes

  Рет қаралды 46,317

That DevOps Guy

That DevOps Guy

Күн бұрын

Subscribe to show your support! goo.gl/1Ty1Q2 .
Patreon 👉🏽 / marceldempers
Today's video is all about StatefulSets and how they help us to run workloads that require persistence. These can include databases, caches, message queues and anything that requires data to be stored. Stay tuned for my video on persistent volumes as it will also play a big role in managing and running stateful workloads on Kubernetes. If you are new to Kubernetes, check out my getting started playlist on Kubernetes below :)
Also if you want to support the channel further, become a member 😎
marceldempers.dev/join
Checkout "That DevOps Community" too
marceldempers.dev/community
Checkout the source code below and follow along :)
If you're interested in learning more about Kubernetes, checkout my series below:
Kubernetes Guide for Beginners:
---------------------------------------------------
• Kubernetes development...
Kubernetes Monitoring Guide:
-----------------------------------------------
• Kubernetes Monitoring ...
Kubernetes Secret Management Guide:
--------------------------------------------------------------
• Kubernetes Secret Mana...
Like and Subscribe for more :)
Source Code
--------------------------------------------------------------
github.com/marcel-dempers/doc...
Follow me on socials!
marceldempers.dev
Twitter | / marceldempers
GitHub | github.com/marcel-dempers
Facebook | thatdevopsguy
LinkedIn | / marceldempers
Instagram | / thatdevopsguy
Music:
Track: Johny Grimes - Levity | is licensed under a Creative Commons Attribution licence (creativecommons.org/licenses/...)
Listen: / levity-1
Track: Loxbeats - Surface | is licensed under a Creative Commons Attribution licence (creativecommons.org/licenses/...)
Listen: / surface
Track: Amine Maxwell - Le Soir | is licensed under a Creative Commons Attribution licence (creativecommons.org/licenses/...)
Listen: / le-soir
Track: Sappheiros - Willow | is licensed under a Creative Commons Attribution licence (creativecommons.org/licenses/...)
Listen: / willow
Track: souKo - souKo - Parallel | is licensed under a Creative Commons Attribution licence (creativecommons.org/licenses/...)
Listen: / parallel

Пікірлер: 111
@anibaldk
@anibaldk 3 жыл бұрын
Dude, your series on k8s is - by far - the celarest, most concise and illuminating set of vids out there. I sincerely commend you, sir.
@ayomidewilfred1864
@ayomidewilfred1864 Ай бұрын
I will rate you 100% . The content was too notch and the explanation was just what I need now. I wanted to deploy a postgres database on k8s, so I sort for resources on data persistent and I couldn't find any that is more explanatory. Your sample that resides in github was top-notch.
@armadillo7171
@armadillo7171 2 жыл бұрын
I am on the virtuous path of watching every single video of this channel. An practice it. So far it is going great and I have learned a ton.
@akhileshjoshi3999
@akhileshjoshi3999 3 жыл бұрын
Your vedios are really helpful and i love the the way you explain it with real time use cases. Would request you to cover helm charts from scratch to complex. Lets say how to create helm charts, how to convert our own applications to helm charts etc etc. I would love to have some series of vedios on this with the ongoing standard use cases which currently organisations are doing. Thanks! keep the great work going going. Happy learning!!
@vikibadoni
@vikibadoni 3 жыл бұрын
Very helpful. Thanks for the videos with a good emphasis on the "Why" part.
@konstantindimitrov2019
@konstantindimitrov2019 2 жыл бұрын
I think I said it in one of you first videos but again, you are the best DevOps educator on youtube. Clearly you've got experience that many others don't. Your vids aren't some robotic read-out of the official docs for views, so I can always find something new. Great style, great structure. You definitely deserve more recognition but it's getting there and certainly it will get there!
@hellboy0666006660
@hellboy0666006660 2 жыл бұрын
I don't know what I would do without your channel. You have an amazing skill to explain complicated topics in such a wonderful, easy-to-understand way. Keep going!! A video with Tekton would be great, if I can propose something.
@piotrkondraciuk7051
@piotrkondraciuk7051 3 жыл бұрын
Love ur content! Keep on rockin'
@dalohse
@dalohse 3 жыл бұрын
you, sir, are answering all the exact questions which no one other answers. thank you.
@derpherp1000
@derpherp1000 3 жыл бұрын
This is a very very good tutorial. Thank you and subscribed!
@viktorgadachek3933
@viktorgadachek3933 3 жыл бұрын
Very well laid out. Great job!
@minhthinhhuynhle9103
@minhthinhhuynhle9103 2 жыл бұрын
Thanks to you, I learned a lot of "production / professional" ways to understand and implement those strategies. None of your videos get bored, I even watch some vid 5-6 times to strengthen my knowledge until I completely understand everything. Thank you for your supports.
@MultiDorin1996
@MultiDorin1996 3 жыл бұрын
Nice explanation! Keep up the good work!
@olenaqwerty7895
@olenaqwerty7895 2 жыл бұрын
very good in-depth explanation. just what was looking for. thanks
@Admiral.MacDonnell
@Admiral.MacDonnell 2 жыл бұрын
You are so precise, even laser beam refracts. I really like your presentation. Thank you!
@yakirtzadik2703
@yakirtzadik2703 3 жыл бұрын
You're the best man, this video is amazing as always
@tiagomedeiros7935
@tiagomedeiros7935 2 жыл бұрын
stateful explained in a very clear way. Thank you for the video.
@pigrebanto
@pigrebanto 7 ай бұрын
Great video, thanks!
@user-bq8yw2sd8p
@user-bq8yw2sd8p 3 жыл бұрын
Thanks a lot for your videos! It is extremely helpful!
@NiteshKumar-do4en
@NiteshKumar-do4en 3 жыл бұрын
You are best keep sharing the concept and. Keep it simple as other devops video are not easy to understand on another channels
@Im_Ninooo
@Im_Ninooo Жыл бұрын
super well explained! thank you!
@PradeepKumar-jh2gn
@PradeepKumar-jh2gn Жыл бұрын
Excellent video! Thank you!
@radonspace2098
@radonspace2098 2 жыл бұрын
Peace Marcel, You are the man!
@sandy5550
@sandy5550 11 ай бұрын
I loved this stateful sets explanation
@NecquiTeja
@NecquiTeja 2 жыл бұрын
Awesome explanation! Thank you.
@shanef1867
@shanef1867 3 жыл бұрын
Your video on the topic is excellent!! I would love to see more examples of statefulsets because your video has raised some critical issues about cluster failure which couldnt be automatically resolved by the kubernetes engine and may require manually fixing the cluster setup. Can you please show possible solutions on fixing cluster issues that cannot be automatically resolved by the k8s engine?
@Hamsterzilla1349
@Hamsterzilla1349 2 жыл бұрын
StatefulSets are an interesting beast. When I first ran into them, I didn't know what to make of it : I've always thought of k8s as stateless-oriented and StatefulSets felt like an anti-pattern. Once I looked into clustered / high availability databases and the on-going work in that space, it made a lot more sense (I'm a big fan of Stolon, if you're into distributed Postgres). K8s is really a great engine to distribute *stuff*, it doesn't have to be microservices.
@Belal-Khan
@Belal-Khan Жыл бұрын
This is an awesome series, but I wanted to point out an issue with the command @22:28. The command adds an extra ":6379" at the end of the string which is recorded in the env var. The output from: kubectl -n example get pods -l app=redis-cluster -o jsonpath='{range.items[*]}{.status.podIP}:6379 ' in my case was: "10.244.0.6:6379 10.244.0.8:6379 10.244.0.10:6379 10.244.0.12:6379 10.244.0.14:6379 10.244.0.16:6379 :6379" This causes the next cluster create command to fail. Took me a little bit to understand why the command was failing if anyone else runs into the issue.
@deepeshchauhan202
@deepeshchauhan202 3 жыл бұрын
Informative video . Keep on Going with these type of videos.
@gopinadhlekkala1433
@gopinadhlekkala1433 2 жыл бұрын
It’s very clear and concise.. really appreciate it..
@denisalustau
@denisalustau 2 жыл бұрын
Thanks so much for the content!
@gaogabriel
@gaogabriel 2 жыл бұрын
You can explain very good and in this way many others can understand this technologies
@demiurgus213
@demiurgus213 3 жыл бұрын
Awesome. Thank you!
@devopskey6251
@devopskey6251 Жыл бұрын
You are a great instructor and cross Nana 👏
@nah0221
@nah0221 2 жыл бұрын
This is helpful .. thanks!
@jainkrohit
@jainkrohit Жыл бұрын
Now that's called pure gold 💰 . Awesome stuff mate ! 👏
@jkuruss
@jkuruss 3 жыл бұрын
Great explanation!
@xunianzu
@xunianzu 3 жыл бұрын
Great content. Thank you!
@RaviSingh-ix3nr
@RaviSingh-ix3nr 2 жыл бұрын
The way you explain concepts and then finish them with real world examples is what most engineers wish to see. Redis, RabbitMQ I have watched both and request you to deploy more such complex applications. Also, if you can tell us what could be the best setup for cluster monitoring and how to approach to solve real world cluster down scenarios, that would be great.
@soubinan
@soubinan 3 жыл бұрын
Amazing video! thank you!
@chornsokun
@chornsokun 3 жыл бұрын
Good job mate! it easy to digest ;)
@mohammedshahbaazshareef5549
@mohammedshahbaazshareef5549 3 жыл бұрын
Great explanation.
@hamidullahmuslih6301
@hamidullahmuslih6301 2 жыл бұрын
you are awsom! thank you the DevOps guy))
@merluisetia2483
@merluisetia2483 2 жыл бұрын
Nice work!
@shreejitpanchal
@shreejitpanchal 3 жыл бұрын
Very Very helful vedio and was very easy to understand StatefulSet. Thanks you so much...
@BemusedSoliloquy
@BemusedSoliloquy 2 жыл бұрын
Outstanding video mate. I'd say you are a welcome addition to our sunny shores but you chose VIC instead of WA :P Just teasing Melbourne rocks, lived there for 4 years myself as a young lad.
@NaNa-lt1po
@NaNa-lt1po 3 жыл бұрын
holy crap! what a video... awesome!
@MrKhaledpage
@MrKhaledpage Жыл бұрын
it alway nice watch your videos ! best ever!
@bkarmay
@bkarmay 2 жыл бұрын
Hi Thanks for the brilliant content! Does the redis deployment automatically distribute across six note? If I have a taint on master nodes I guess that will be an issue? Cheers
@anuptripathi3286
@anuptripathi3286 3 жыл бұрын
love ur content please make a video on Daemonset
@Fayaz-Rehman
@Fayaz-Rehman 3 жыл бұрын
Wonderful - Well explained - does this apply to Kubernetes version 1.20 with containerd ?
@simonlock9718
@simonlock9718 3 жыл бұрын
Great video. I have a database application running in pods (windows) using stateful sets, but my persistent volume is statically provisioned. The database file system is not created by the application so needs to exist prior to pod startup. How could I cater for additional persistent volumes if I want to scale up replicas?
@vyankateshkudtarkar7919
@vyankateshkudtarkar7919 3 жыл бұрын
Your Just Awsome!!! Very helpful.
@carloslin6818
@carloslin6818 3 жыл бұрын
Thank you so much for your video. I have a question about scaling down Cassandra cluster, as you know, Cassandra cluster will store all the data in different databases, let's assume we have 5 Cassandra databases with replica of 3, and then scaling down to 1 Cassandra database, how can we know if the left Cassandra database consists all the data of the 5 Cassandra databases. Or it is not possible to do scaling down Cassandra like Redis in k8s? Thank you very much
@itaco8066
@itaco8066 2 жыл бұрын
MVP Channel! 10x Marcel 🙏
@araujobsdport
@araujobsdport 6 ай бұрын
That was master class :)
@richardokonicha
@richardokonicha Жыл бұрын
This fellow is no mere mortal
@jaysistar2711
@jaysistar2711 2 жыл бұрын
Hey, do you have a video describing how to make an EBS based StatefulSet in AWS? It seems that there's an issue reguarding EBS volumes being bound to an AZ. I heard that I should create an ASG per AZ, and make my StatefulSet have Pods across the AZs, but I don't know how to enforce that behavior. Most of my volumes are EFS and FSx so far, but I'd like to run a database in EKS, which would need EBS for speed, and I don't want to miss anything.
@georgelza
@georgelza 2 жыл бұрын
just rewatched this... thinking I'm picking up on the complexity of stateful sets and ... a stretched environment like multiple AZ's as present on AWS EKS... any chance you've done a video, where say 3 or more stateful sets are pined to nodes (AWS EKS Nodegroups). this can then be used against the Redis deployment and PostgreSQL deployment ?
@MarcelDempers
@MarcelDempers 2 жыл бұрын
My Redis series does this already. A statefulset will pin a pod to the same node's volume claim. Unless that node disappeared, the pod will always stay on that node. If a rolling node upgrade occurs which my roll new VMs, you may lose data ( depending how the cloud provider does updates)
@georgelza
@georgelza 2 жыл бұрын
@@MarcelDempers understand the stateful pod will gravitate back to where the pvc is, but i want to pin/direct the pod before that, I have a EKS cluster spread across 3 x az's, and additionally the cluster have node groups for apps and nodegroups for db... i want to direct the stateful set to the database node groups, and additionally push each of the Redis masters onto a node in each of the az's.
@sumer9999
@sumer9999 3 жыл бұрын
super thanks!!!
@Aryan21able
@Aryan21able Жыл бұрын
I would like to add a correction, please correct me if I'm wrong. At 12:18 you said in deployment scaling the pods scale all at same time but I think with rolling updates we can choose % of scaling pods at a time.
@JohnDoe-dn2bg
@JohnDoe-dn2bg Жыл бұрын
In your example you used ClusterIP type of service. Is headless service not one of requirements for statefulset? Or I can still use ClusterIP? Good video anyway, thanks.
@syedsaifulla8961
@syedsaifulla8961 3 жыл бұрын
Thanks for your support on kubernetes.. My request could you please make zuul api gateway for kubernetes cluster for routing
@wasimshaikh-ns7pu
@wasimshaikh-ns7pu 3 жыл бұрын
Hello Marcel, Can you make a video based on DevOps security aspects ?.. Like all things to be considered when we think about security in CICD? Like as a hiring manager what all u think is important and relevant.
@luca.m.gennari
@luca.m.gennari Жыл бұрын
Best video ever...
@amalmishra11
@amalmishra11 2 жыл бұрын
Could you please make a video on stateless set
@kunchalavikram
@kunchalavikram 3 жыл бұрын
Hi, the yamls shown in the video are different from the git. For instance the service type for redis cluster used in the video is ClusterIP but in git its headless service. Also why service name is to be mentioned in statefulset definition?
@sf2998
@sf2998 3 жыл бұрын
Does statefulsets already includes data & file replication?
@damiantracz680
@damiantracz680 3 жыл бұрын
Very helpful :)
@navneet5781
@navneet5781 3 жыл бұрын
another good videos on Kubernetes.. can you please make video to capture logs of application in cabernets in ELK with cabana or any other tools to view app logs
@MarcelDempers
@MarcelDempers 3 жыл бұрын
Thanks for the kind words 💪🏽 We have started that journey already 🤓 Come follow along kzbin.info/aero/PLHq1uqvAteVvfDxFW50Mdezk0xum-tyHT
@roshansharma3438
@roshansharma3438 3 жыл бұрын
Hi At first would like to thank you for the wonderful videos...I am having request... Could you please make a detailed video on how MySQL High availability works and how to configure it on k8s. Also detailed video from. Basic to Advance on K8S Networking.. Thanks a lot in Advance..Stay Safe..!!
@TuuThur
@TuuThur 3 жыл бұрын
Hello, thank you for the tutorial ! I've got some questions at 25:30 you show that PV are retained but the reclaim policy is set to Delete. How does it work ? Does it only occur when the StatefulSet get fully deleted ?
@MarcelDempers
@MarcelDempers 3 жыл бұрын
Great question. As per documentation, For reclaim policy "Delete", the volumes are only deleted when the PVC's are deleted. Current statefulset behaviour is PVC's are not deleted with pods or the statefulsets are deleted since they have a different lifespan.
@TuuThur
@TuuThur 3 жыл бұрын
@@MarcelDempers thank you
@emilne83
@emilne83 Жыл бұрын
Learning about PVs and noticed that all of the PVs deployed into our cluster have the reclaim policy = Delete, which had me concerned that our engineering team had possibly made a terrible oversight in the deployments. This comment is exactly what I wanted to understand. Thank you so much for this comment and the excellent statefulset tutorial!
@TheChihuhua
@TheChihuhua Ай бұрын
THE BEST!
@eniac78
@eniac78 7 ай бұрын
I was looking over the Github repo for the redis stateful set. I have a question. If each replica is mounting to the same host path is there any chance for mounting collisions and data corruption?
@MarcelDempers
@MarcelDempers 7 ай бұрын
At least the subPath on the host needs to be unique. Each pod should have it's own data, yes
@MarcelDempers
@MarcelDempers 7 ай бұрын
Checkout the Redis playlist on the channel for a more in-depth Redis setup
@fabiano9714
@fabiano9714 3 жыл бұрын
How does the redis cluster keep track of the new pod members when you scale up the statefulset ?
@MarcelDempers
@MarcelDempers 3 жыл бұрын
Checkout my Redis guide which includes a video on HA and Kubernetes kzbin.info/aero/PLHq1uqvAteVtlgFkmOlIqWro3XP26y_oW
@anushakalyanimuttu145
@anushakalyanimuttu145 3 жыл бұрын
Perfect
@devopskey6251
@devopskey6251 Жыл бұрын
Please let me know which software you are using for diagram
@georgelza
@georgelza 2 жыл бұрын
definitely helped explain stateful sets and pv's snd pvc's... but now to map to real world... 2 AZ's on AWS with Prometheus deployed, with a ALB in front ? if the Prometheus servers were running on the same node I'd say lets use deployments, that way either node would have access to all the data, but then you going to have duplication where they scrape the same target. lets make it simpler. one prometheus server, running active in AZ1.. but it needs to be protected to be able to fail over to AZ2... snd as I discovered EFS not allowed.
@Bhatt_Aryan
@Bhatt_Aryan Жыл бұрын
how do we make cluster of multiple nodes using docker for windows?
@bryanrecinos8297
@bryanrecinos8297 2 жыл бұрын
If I get the job I will send you a beer !
@bogdanM29
@bogdanM29 3 жыл бұрын
first. can you please do a scheduler video?
@meghagn4553
@meghagn4553 3 жыл бұрын
hello Marcel !! could you please let me know how to troubleshoot based on the error at the end of ur video ( scale down to zero - and then making up the replicas , but still the cluster is down ) how to overcome this ?
@MarcelDempers
@MarcelDempers 3 жыл бұрын
It's an interesting issue right ? :) This is part of the reason I recommend SaaS solutions for storage. I myself am not a Redis expert, so I would need to dig into 1) Redis cluster best practises, 2) Redis cluster troubleshooting \ repair process. I am planning a Redis series in the future 💪🏽
@santoshsah4
@santoshsah4 3 жыл бұрын
@@MarcelDempers Thank you for great video. Have you come up with any solution for this issue? Is Redis Sentinel answer for this issue?
@charlesuneze4920
@charlesuneze4920 Жыл бұрын
Sweet
@cank4286
@cank4286 2 жыл бұрын
Is it ok to use pod ip's for clustering? I think If pods get rescheduled their pod ip addresses will change and break the redis cluster.
@MarcelDempers
@MarcelDempers 2 жыл бұрын
Correct, you dont want to use Pod IPs. You'll want to use K8s headless services with statefulsets. Take a look at my Redis playlist as an example.
@alirexahashemi1035
@alirexahashemi1035 2 жыл бұрын
Peace! ☮
@krishnamohanyerrabilli4040
@krishnamohanyerrabilli4040 Жыл бұрын
👏
@moosegoose1282
@moosegoose1282 2 жыл бұрын
Ur arms are ripped dude
@vidadjurdjevic9783
@vidadjurdjevic9783 2 жыл бұрын
You are beautifully pumped man. But please don't jump so quick from example code to yourself. Nice videos. Thank you!!!
@xunianzu
@xunianzu 3 жыл бұрын
Is it mandatory to use headless service with StatefulSet?
@MarcelDempers
@MarcelDempers 3 жыл бұрын
Good question. I have not tried it. The statefulset spec.serviceName might have some mandatory requirements, but nothing stops you from creating another clusterIP service or LoadBalancer one and selecting the statefulset pods with a label selector, if you need to
@andrewv5457
@andrewv5457 Жыл бұрын
How do we fix that cluster outage then? 🤔
@L84netlol
@L84netlol 3 жыл бұрын
Hello, I use microk8s and run $IPs = $(microk8s.kubectl -n example get pods -l app=redis-cluster -o jsonpath='{range.items[*]}{.status.podIP}:6379 ') I got =: command not found How can I solve this problem?
@loganrobert5811
@loganrobert5811 3 жыл бұрын
I'm having the same problem
@ghauri001
@ghauri001 3 жыл бұрын
best
@kos4290
@kos4290 Жыл бұрын
great channel - it would be better just to show the screen though - the montage is too hectic
@ehsanShirzadi
@ehsanShirzadi 2 жыл бұрын
Dude, I really like your efforts, I've learned alot. No offense but whenever I see you I think It's a murderer trying to teach k8s :D
@balintg
@balintg Жыл бұрын
you are beautiful
@DawidSwitonManiakowski
@DawidSwitonManiakowski 3 жыл бұрын
You are talking too fast sometimes, when I watch yours videos i need to pause coule of times and rewind 20 sek to catch everything I need. But sometimes there is a lack of details for example how this web app is connecting to redis in this example
Persistent Volumes on Kubernetes for beginners
18:47
That DevOps Guy
Рет қаралды 50 М.
Understanding Kubernetes RBAC | Access control basics explained
33:29
That DevOps Guy
Рет қаралды 47 М.
ДЕНЬ РОЖДЕНИЯ БАБУШКИ #shorts
00:19
Паша Осадчий
Рет қаралды 5 МЛН
Como ela fez isso? 😲
00:12
Los Wagners
Рет қаралды 30 МЛН
狼来了的故事你们听过吗?#天使 #小丑 #超人不会飞
00:42
超人不会飞
Рет қаралды 61 МЛН
Microsoft Build 2024 Recap
1:40:39
Boston Azure
Рет қаралды 1
Kubernetes StatefulSet simply explained | Deployment vs StatefulSet
16:00
TechWorld with Nana
Рет қаралды 221 М.
Should We Run Databases In Kubernetes? CloudNativePG (CNPG) PostgreSQL
19:10
Kubernetes Daemonsets explained | Tutorial | Kubernetes Guide
27:00
That DevOps Guy
Рет қаралды 16 М.
Simplify Kubernetes YAML with Kustomize
20:37
That DevOps Guy
Рет қаралды 74 М.
Statefulsets | Deploying MongoDB cluster to Kubernetes
18:22
Pavan Elthepu
Рет қаралды 23 М.
Understanding KUBECTL - Learning Kubernetes
40:34
That DevOps Guy
Рет қаралды 10 М.
Kubernetes Explained in 15 Minutes | Hands On (2024 Edition)
15:18
Travis Media
Рет қаралды 51 М.
Understanding CPU & Memory with the Kubernetes Vertical Pod Autoscaler
22:12
Куда пропал 3D Touch? #apple #iphone
0:51
Не шарю!
Рет қаралды 942 М.
ПРОБЛЕМА МЕХАНИЧЕСКИХ КЛАВИАТУР!🤬
0:59
Корнеич
Рет қаралды 3,5 МЛН
AMD больше не конкурент для Intel
0:57
ITMania - Сборка ПК
Рет қаралды 519 М.
How much charging is in your phone right now? 📱➡️ 🔋VS 🪫
0:11
ПК с Авито за 3000р
0:58
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 1,6 МЛН