(English) Kubernetes Redis High-Availability Cluster: Step-by-Step Guide to Setup Redis Sentinel

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
guys in this video I'm going to show you how we can set up the highly available radius cluster on kubernetes and I'm going to use the gcp and we are going to set up that particular cluster on gke and we are going to use the bitnami helm charts for redis and in that particular chart we are going to use sentinel so what Sentinel is I'm going to show you guys so let me connect to this uh kubernetes cluster and connect it so if you do if I do Cube CT I'll get nodes you will see the three nodes are going to be available right so uh other than that I've created uh a page in my repo and I'm going to share that particular link of that vietnami redis cluster which we are going to deploy so on Google you just have to type it can we write this GitHub and you will see this redis and if you navigate to this uh album chart repo provided by bitnami and if I navigate to a ready section you will see and there are two directories ready and radish cluster right so what is the difference so if I open this link red is and at the link is redis cluster so if you see in this radish and redis cluster you will see both these diagrams are available so uh if you see the red is uh red is with Master it has one master node with two slaves and other has multiple Master with three slaves but you definitely can set up the redis uh with the you know multiple slaves and similarly in this way you can set up that but the point is that with single Master how we can achieve the high availability for high availability radish is provided the Sentinel and we are going to use this and this is going to be the highly available redis cluster with single Master but zero down and down time right so I'm going to show you if we set up this cluster without Sentinel what is the difference and which Sentinel what is the difference highly available uh cluster we are going to set up with Sentinel and what it does it will um it will be giving you guys uh uh highly available along with no downtime so let's try to do if I navigate to my redis page you will see that I added these multi-master cluster with single database so this is the diagram and this has the single database and you can read the bitnami um readme MD and and they have provided a good documentation right so and other than that what we are going to do a single Master is a typo I'm going to fix it single Master with multiple databases and with Sentinel we are going to set up the highly available cluster so uh let's do that and what steps you need to do I'm going to show you guys so guys what you need to do uh simply clone this repo and in fact let me instead of cloning I just want to download this Depot and I'm going to show you what you need to do in fact Our concern is just to directories so let me navigate to the download section right and I just want to show you this stuff so let me remove the other stuff and okay and I'm going to Simply extract this guy right click here and from this [Music] um in technology not two directories our concern is only redis directly so as we've shown you guys you can navigate to the Vietnamese section you will see these two directories uh which I shown you from the UI redis and redis clusters so simply what I'm going to do I'm go I'm going to copy this guy and put it in my container directory so this is my container math on the Windows desktop so if I do LS you will see this is redis and and this is the red is inside here inside Red Is Right so what I'm going to do let me open this in in vs code and I'm going to create one file just commands just to show you guys that what command you need to have and although I've provided the command excuse me in the UI so that part is done so let me remove this stuff extra bits so it's going to be easier for us so anyway uh what I'm going to do first thing first I'm going to export this um this guy right because we are using the Sentinel and I'm going to export this is the password we are going to use and I'm going to export it and the other command is Helen dependency build but before that we need to uh first of all um uh check Helm wrapper list and if it if this chart is not added we are going to add that so let me do that okay we don't have anything so okay if anything other than that you can do that as well so what we are going to do uh we are going to Simply add this command and okay uh Helm is not installed so I thought I Helm installed so let's see the helm installation it's a container and we are going to Simply install the help so I thought Helm is already installed so simply what you need to do regarding the installation of Health okay this guy and simply paste it so and we are going to use this command and simply do this command right so what it does it will install the latest uh uh Helm package for us and the latest version it is going to be installed so that is done so if I do help you will see the commands so and you see now commands are coming I'm going to remove any relief things as it is even you can remove this guy get health gel and so excuse me so let me add this repo here and this is the bitnami dot which we are going to use and let me do the helm repo update now so going to update everything regarding that so if I do LS and I need to simply navigate to this helmet radish and what I'm going to do uh I'm going to use this uh single Master with high availability and I'm inside that particular directory I have exposed this redis password so now I'm going to use this command Helm dependency build so what it does it will um made all the dependencies and then what we are going to do simply I'm going to copy this command and put it here and I just want to show you what it is so let me do that so um Let's Start From Start uh Helm upgrade install red Sentinel uh this is the chart name the namespace is going to be the redis Sentinel if the namespace is not this and be created definitely this namespace is not created so uh values DOT cameras is going to be a default but we are going to override that particular values.kml with our specific settings so set Sentinel enable true volume permission enabled through um auth regarding the password I mean replica account is going to be three right and later on I'm going to show you how we can add more replicas right um auth password we already added through environment variable and other settings are the liveness probe and uh Master persistence regarding the size and the replica persistence so we are going to use 10 gigs you can change the size later or I mean you can add your required size so simply let me copy this guy and simply paste it right so let's do that and what it does I'd say that red is Sentinel uh this uh does not exist but what it does it is going to create um one name space and it is going to deploy that so what I'm going to do uh let me navigate to my main Mount what I'm going to do I'm going to uh to first of all uh copied stuff regarding uh password I want to show you stuff regarding the cube cdfs let me show that keeps it will get parts in namespace red is the Sentinel so what it does it is going to create the status right and let me uh copy the stuff regarding the copyright for config foreign this I already covered in my previous videos so it gives more visibility to you guys what is that thing and um till then I'm going to show you the stuff what is going on with watch command and foreign cluster seems to be added that this is the cluster right and let me uh show you the stuff from in the UI so navigate to the workload spot namespace is going to be ready Sentinel you see in the provisioning of parts right we have zero one two node uh setup as we have set up the replica's account to three and in that particular you see these two greens are two containers running in a single pod if I hover to this you see red is a container and other is Sentinel so uh I'm going to show you what's the difference uh running Sentinel and radish together so uh let me navigate to the state filter you see three state rule sets are regarding the three nodes are available so let me show you the stuff regarding the high availability so uh let me remove one of the port and you will see the two parts are going to be still running with zero downtime so remove that okay so uh I'm going to remove this part you see there is no change in these uh pod I mean as far as the um High availability is concerned I mean what Sentinel does it will change the master to different node and our cluster is going to be still available and running right and I'm going to show you this part as well so let it finish and so what I'm going to do first of all uh take a shell into radish okay so um if I do a with the red is CLI right commands I've already added so um if I try to do uh right click info application for replication right it will prompt for the authentication auth is going to be Cloud Peaks which we have provided through our uh environment variables so if I use the same command in for replication right so you see that um this is uh his slave and previously it was Master although I have not shown you guys but let's try to see the or take a shell into other part you will see that let's try to take uh Charlotte to this guy and let's see and if you see this pod you you will see that it will tell us that it will show us the information regarding who is the master host so definitely this is going to be the master host and um okay let me show you guys as well so to auth Cloud Geeks Cloud Geeks uh one two three four five six seven eight this is the password right and if I do info uh sorry info for application give me then for regarding the replication right so you see this has the role master and this has the role uh roll slave right this one so let's try to Simply remove this guy I just want to show you the higher high availability so I'm going to remove this part and definitely the shell is going to be you know gone from this part but you see it is terminating but other parts are going to be you know keep running and you will see that um the information regarding the parts uh are going to be updated so this is disconnected and what we are going to do uh we are going to do um all right again about X this is our password right and okay sorry uh I need to do ready CLI first and do auth um loud keys one two three four five six seven eight and now I'm going to say info replication invite so uh you see now this has the master role back to master and uh I mean it it provides the other slaves information you see and that is how we can achieve the high availability and because we have enabled the Sentinel to true so this is very important to make sure that you have uh that discarded true and also we have our persistency to the the system volume so if if you navigate to the storage section you will see the persistent volumes uh are going to be created and are pounded so you can see from here as well the storage section and PVC and you know persistent volume claims so uh let me do one more stuff what I'm going to do to give you a demonstration um let me take another shell and if I do Docker PS and do Docker exact infective shell uh into that GK part and let me uh let me see it into redis and what I'm going to do again do the same steps uh What uh first of all I need to export this environment variable redis password right so let's do that and then what I'm going to do I'm going to disable um dependency build and although we have already built it but what I need to do I'm going to change the uh change the values here and the command I've already copied I'm going to change that so let me first of all show you guys this is uh sorry and let me just bring this guy from start okay so let's try to uh put this in the redis namespace right and uh I mean um install this is the name of the chart right and call this in the write its name space and and I'm going to disable Sentinel so instead of true I'm going to save false right so let's try to copy this command and we are going to deploy uh the same stuff but you know in a different name Space by you know disabling The Sentinel and it is going to be the pretty much same step but disabling The Sentinel and in the name space Brad is so let's do that you see uh now what I'm going to do I've shown you this stuff so if I navigate to this section radius we have new namespace and um you will see that zero master and zero replicas are started to provision and if I navigate to the section from the UI you can see and the persistent volumes are going to be available so what you need to do simply refresh it and see the stuff you see this is the name space which we are going to select so um it has found the master and replica zero so let it run let's wait for a while and even uh from the helm section you will see the releases and you will see the redis in the name space right is this the first release and we have two other release in the redis Sentinel namespace so simply uh what we are doing here uh is doing the testing regarding the high availability so let it uh run first I mean let's see what is the difference between uh the red is plane without Sentinel and the red is Sentinel I've already shown you guys so it's going to be available soon so let's try to see you see there is no other container no Sentinel uh container involved so uh it is going to uh set up the you see we have zero Master a replica one two three so let's try to do that and and if you see the difference the Sentinel it has two parts you know sorry two containers in a single part so if I navigate to the radius again and what I'm going to do let it run fast and I want to show you it has the information regarding the master and we have only Master without Sentinel so let's try to uh remove the master see what's happened so let me do that I'm going to remove the Pod and see what's happening so I've removed the master node and uh I wait for a while so Tower Master is uh remove what it does it is going to you know uh restart the Pod again so see other parts are again failing see that is the different now we have restart on all the other part spots so that is the difference and that restart is going to be back when that particular uh all this up so this is not high availability although we have single master but we don't achieve the high availability and we have down time as well a sentinel you see we have restarted all three parts they see that this guy is back now the restart has gone so that is how you can achieve the high availability with Sentinel and uh the other thing I just want to show you in the last uh let's try to uh go back to our previous stuff in the Sentinel I just wanna wanna do I wanna update the replica count to five so let's do that and simply I'm going to copy this guy right so the advantage I've already shown you guys and also this says the advantage that uh you can set up multiple database so let's try to add more nodes and things like our coffee is not okay so okay let's do this how upgrade and what I'm going to do uh the subject account so let me copy this guy and play interface the information here right so now we have changed the okay we are not in the radish directory which is containing I should be in this particular radius and definitely values values.tml is living here so that's why I need to be CT I should do CD into that particular red is directory right so um authentication is available by default authentication operators is not there so you can set it up uh in my other videos I will cover the E case as well but the steps are pretty much are going to be the same so uh this is the video with regard to that high availability and difference between the plane radish and reddish Sentinel so you see uh the other nodes are started and once these nodes are healthy you see there is no uh I mean change in the other nodes as far as the you know this is going to you know contact this cluster and it is going to be the part of that particular cluster so you see it is in pending State and it is going to pass to in the waiting for the volume permission is going to be completed and then it's going to be part of that particular cluster so let it complete and you will see that let me navigate to this section uh regarding the Reddit Sentinel and we have just updated from [Music] three to five um you see all five are now available and foreign the good thing now you will see the other odd are going to be updated which was previously there that is one of the most important thing I need to show you guys so um after uh updating this what it does it is going to update the Pod uh number with node one and then it is going to update the node one so why it is updating without zero downtime it is going to update all the odd automatically so it it has uh you see now it is available all three are up I mean no there is no downtime without downtime it is going to update one by one so once it's updated it is going it is going to switch to other pod which is going to be on node 0. so you will see lastly that I'm going to show you the cluster with four nodes and you can see also uh the logging as well let me let me first show you guys so you see now it's it is terminating but on our cluster we don't have zero down 10 because our cluster is highly available and slowly slowly it is going to update all the parts on notes right so you can see the logs from section as well so let me do that okay so uh everything is up and running so let me show you guys you see everything it's green so let me show you the logs of Sentinel right so these are the configuration and everything regarding the Sentinel and take the logs and other logs you can see is of red is right so everything seems to be perfectly working right and you see the replication between Master is available and from the UI I just let's see who is the master so take a take a shell into this and let me show you guys for the last time right so uh if I do redis uh Eli and auth uh that's the cloud kicks three four five six seven eight and uh I do uh info replication right so uh you see this has the roll slave and the master node is now node three so let me simply close it and this is our message now so guys uh this is the video uh hopefully you will understand and if that is how easy it is to set up highly available redis cluster on kubernetes whether you're using EK eks or your on-prem uh cluster if you like the video please like share and subscribe the channel and have a nice day
Info
Channel: DevOps Gang
Views: 5,529
Rating: undefined out of 5
Keywords: kubernetes, redis, high availability, redis sentinel, kubernetes redis HA, clustering, resilience, devops, microservices, no-downtime, step by step guide, tutorial
Id: eVa1Hbxice8
Channel Id: undefined
Length: 28min 59sec (1739 seconds)
Published: Fri Dec 16 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.