Тёмный

Kubernetes Controllers, Custom Controllers and Operators explained with use cases 

Vivek Singh
Подписаться 8 тыс.
Просмотров 11 тыс.
50% 1

In this video we looked into what exactly are Kubernetes controllers, Custom Controllers and Operators in Kubernetes.
We actually started with the controllers that are running as part of Controller manger and then defined the custom controller.
A part from that we also looked into the use cases of Operators and then defined them.
The use case that we looked into was managing a distributed database on top of Kubernetes, we discussed about the problems that database administrators will encounter if they want to add another node on the DB cluster or if in case they have to change the leader node.
Web:
viveksingh.dev/
Twitter:
/ viveksinghggits
00:00 Introduction
00:18 Agenda
00:34 Brief Kubernetes Controller Manger
01:43 What are Kubernetes Controllers
02:14 Deployment Kubernetes Controller
04:01 Improved definition of Controllers
05:23 Browsing through Controller Manger's Controllers
06:10 Querying current state of cluster
08:43 Current state and expected state
09:13 What are Custom Controllers
10:07 Discussing controller that syncs secrets b/w namespaces
12:57 Running distributed database on Kubernetes
13:46 Adding a node on database and manual intervention
17:02 Changing Leader of DB Cluster
17:45 How operators help us
18:28 Operators with Custom Resources
22:06 Conclusion
23:03 thanks for watching

Опубликовано:

 

28 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 54   
@crujzojam7004
@crujzojam7004 Год назад
Great video!! Is it safe to say that If CDRs are present then they belongs to an operator only? Can controllers also create CDRs ? Please help me understand
@viveksinghggits
@viveksinghggits Год назад
Hi Crujzo, There isn't much difference between controller and operator functionality wise. Both are applications that watch for user specified state and then make sure cluster is on the same state. For example if a user says I want a MongoDB database running, controller/operator is going to make sure that you have a MongoDB database running on the cluster. You would use the word operator for controllers that have more domain level knowledge about the thing that its managing for example, in obove case if the controller also knows how to backup and restore DB, how to add users to DB etc. In that case we can call that controller an operator. I hope this was helpful.
@crujzojam7004
@crujzojam7004 Год назад
@@viveksinghggits Thanks a lot for the quick reply, so that mean operators are more specialized case of controllers, but what I see as a trend that people are moving away from operators as to handle lots of cases the more lines of code inherit potential bugs as well which becomes a problem rather than a simplified solution ... Is my understanding is correct according to you?
@viveksinghggits
@viveksinghggits Год назад
People are moving away from operators to what?
@Babe_Chinwendum
@Babe_Chinwendum Год назад
So so helpful!! Thanks a mil!
@viveksinghggits
@viveksinghggits Год назад
Thank you for watching. I am glad they were helpful.
@basilkurian0
@basilkurian0 Год назад
Thanks for making these videos
@viveksinghggits
@viveksinghggits Год назад
I am greatful for the super thanks and glad that videos were helpful.
@prasunaneerati5626
@prasunaneerati5626 3 года назад
Very well explained.Thanks for the video
@viveksinghggits
@viveksinghggits 3 года назад
Hey 👋, Thanks Prasuna. I appreciate it.
@gv.ramana
@gv.ramana 3 года назад
@@viveksinghggits please help us to make pod security policy. Thank you
@keratishvili
@keratishvili 2 года назад
Great video would love to see more deep dive materials
@viveksinghggits
@viveksinghggits 2 года назад
Thanks 😊 Giorgi, Yes, I do have some great videos planned for coming weeks.
@kunchalavikram
@kunchalavikram 3 года назад
Well explained. Which device you use for writing and the video recording software that displays the speaker's video?
@viveksinghggits
@viveksinghggits 3 года назад
Hey, thanks Kunchla. If you are talking about those drawings, I have a wacom one tablet that I use to draw. To record the screen I use OBS and have a Logitech Webcam to record speakers face. It's OBS' functionality to show speakers video with screen. Let me know of you need any other details, I would be happy to help.
@kingcharles30922
@kingcharles30922 3 года назад
Hi Vivek, can we create deployments using crd? Or is it can just be used to monitor the deployments. I know we already have replication controller to do this job
@viveksinghggits
@viveksinghggits 3 года назад
Hi Ashutosh, "Can we create deployment using crd" Why would you want to do that? CRDs are Kubernetes resources that are created to introduce custom resources (that are not already available in k8s) into Kubernetes. "is it (crd) can just be used to monitor the deployments" If I understood the question correctly you are asking if CRDs are used to monitor the deployments. The answer is NO, they are not used to monitor any resources, as explained in above answer they are used to introduce another resource into the Kubernetes API server. Please let me know if that answers your questions, if no please don't hesitate to ask any other question that you have. I would love to answer them.
@kingcharles30922
@kingcharles30922 3 года назад
@@viveksinghggits Your answer cleared my doubts. Thanks 😊
@viveksinghggits
@viveksinghggits 3 года назад
Like I said please don't hesitate to ask any other question. For example what happens when a CRD is created or what happens when a CR is created. I would be happy to answer them.
@shanelindsay5860
@shanelindsay5860 Год назад
Hi, there do you have any recommendations for reading on launching dynamic sandboxed containers/pods for untrusted consumers of my application? My ideal configuration is allowing a user to launch a docker image as a service dynamically and manage it using my application. I was looking at operators, but it seems to mostly be declarative. I'm not sure what is best practice for launching and managing such services
@viveksinghggits
@viveksinghggits Год назад
Hi Shane, Sorry, I didn't understand the usecase very well. You will have to make your application secure, right? You can not just rely on infrastructure for security.
@niteshsince1982
@niteshsince1982 3 года назад
Hi Vivek. Thanks for the video. Do you also have some code snippets on actually how to write custom controllers? Is their a github repo we can get hands on. Theoretically its clear but want to see some code..
@viveksinghggits
@viveksinghggits 3 года назад
Hey Nitesh, Yes, that is what I will be covering next in my videos. It might take some time though. There are some examples in my github, if you want to check it out meanwhile.
@palashgoel8973
@palashgoel8973 3 года назад
@@viveksinghggits when is your next video coming?
@viveksinghggits
@viveksinghggits 3 года назад
Hey Palash, I will be uploading another video this weekend. But that is not going to be about writing controllers. If you are waiting for the one about controllers, that will be in next weekend.
@kevalbhogayata6031
@kevalbhogayata6031 Год назад
I have a usecase specific query around this. I have a daemonset running on the client clusters. Everytime I update my docker image, I tell my client to restart the daemonset. Can I write a "custom controller to check if a new image SHA is available and restart the daemonset" ?
@viveksinghggits
@viveksinghggits Год назад
Hi Keval, Yes that would be a good solution to tackle the problem of updating the image when a new image is pushed. I would also recommend, checking if combination of image tag and imagePullPolicy can somehow handle this automatically and in that case you wouldn't even need to write custom controller.
@roshankakad9720
@roshankakad9720 Год назад
or do you have any Practical video for operator for my below query as i won't find it
@viveksinghggits
@viveksinghggits Год назад
If you go to playlists on my channel, there is a playlist where I wrote kubernetes Operator from scratch which is named similarly. Let me know if you are not able to find it.
@gv.ramana
@gv.ramana 3 года назад
subscribed. 👍 well explained vivek...to be honestly...pls improve the audio...your subscribers gonna increase like anything. my 2 cents
@viveksinghggits
@viveksinghggits 3 года назад
Thanks Ramana, sure I will work on the audio.
@adityajoshi3360
@adityajoshi3360 2 года назад
What is the difference between helm charts and operator?
@viveksinghggits
@viveksinghggits 2 года назад
Hi Aditya, Have you watched the videos that I have on helm?
@adityajoshi3360
@adityajoshi3360 2 года назад
@@viveksinghggits yes I have seen that, my question is more toward the operator sdk that allow creating operator with helm
@viveksinghggits
@viveksinghggits 2 года назад
So, in short what happens there is, operator SDK can be used to create operator for your helm chart. When we create the operator we specify that this is the chart we want to create operator for. Like most of the cases it would introduce a CR and as soon as the CR created the operator is just going to install a helm release. So you have the helm chart already prepared but because of certain reasons/use cases you would want to have an operator and that's where you can use this.
@partharora8759
@partharora8759 3 года назад
How a particular operator attached to particular CR
@viveksinghggits
@viveksinghggits 3 года назад
Hey Parth, 👋 That's a great 👍question, thanks for asking that. So when we write an operator, we tell it which particular custom resource this operator is going to look for. For example if we write operator for node CR, as explained in video, in operator code we will specify that this is the resource that this operator is responsible for. I am going to cover this in some of the coming videos.
@partharora8759
@partharora8759 3 года назад
@@viveksinghggits okay thanks
@PREETISBAYAS
@PREETISBAYAS 2 года назад
Hey Vivek, In simple words can we say that we have custom controllers for native objects and operators for Custom Resources in Kubernetes. And in functionality of both of them is same?
@viveksinghggits
@viveksinghggits 2 года назад
I think yes, very naively we can say that. Concept is same but functionality is different, in case of operators there are a lot of things that it might need to take care of, internal or external.
@viveksinghggits
@viveksinghggits 2 года назад
For example entire life cycle of the database or the resources that is being created by operator should ideally be handled by operator.
@shamstabrez2986
@shamstabrez2986 Год назад
toh phir dono mein differnece kya hua jb dono hi chizen same work krri h via api server monitor krri resources ko then manual kam ko automate whts the difference between them
@viveksinghggits
@viveksinghggits Год назад
Hi, I think the same question is answered in one of the comments of this video. Try to find that out. If you are not able to, let me know.
@roshankakad9720
@roshankakad9720 Год назад
Hello Vivek , one query is like, how to check how many operators are there. So using kubectl get we can get CR details but how to check which operator is there in our k8s cluster to manage that particular CR. In CR video you have shown kubectl get etcds but operator practical you didn't shows us in this video. Please help me to get this clarify
@viveksinghggits
@viveksinghggits Год назад
Hi Roshan, Using kubectl we can interact with Kuberenetes resources. Operators are programs that work with Kuberenetes resources or use them to do something. Most of times a CRD would have respective Operator running on the cluster. But it's totally possible to just have CRDs and not the Operator, isn't practical though. I hope Using these statements you can figure the answer out.
@roshankakad9720
@roshankakad9720 Год назад
@@viveksinghggits Hi Vivek, its still not clear, Please help me understand in other way around.
@roshankakad9720
@roshankakad9720 Год назад
I just want to see operator in k8s cluster, which logic is defined inside operator then it would be more clear to us if anything happened to CR then what exactly operator will do. We can see crd & cr by using kubect commands. Actually i am not a developer as i am part of devops team thats the reason i am curious to see operator in actual in config. I have see like crd & cr running as a pod so thought of that it would also be running as a pod.i am still in dilemma. i would appreciate if you help me really get out of this confusion 😇
@viveksinghggits
@viveksinghggits Год назад
Roshan, you will have to look at the documentation of the operator that you have installed for more details. And of the operator code is open source check the repo to see the code.
@shamstabrez2986
@shamstabrez2986 Год назад
bhai toh controllers n operators mein difference kya hua jb dono hi chizen custom resource pr kam krri h
@viveksinghggits
@viveksinghggits Год назад
The exact same question is answered in the pinned comment.
@kingcharles30922
@kingcharles30922 3 года назад
Hi Vivek, so can two controllers connect with each other?
@viveksinghggits
@viveksinghggits 3 года назад
Hey Ashutosh, Can you please elaborate the question a bit.
@badmintonSeekers
@badmintonSeekers Год назад
Main difference between Controller an Operator ?
@viveksinghggits
@viveksinghggits Год назад
Have you watched the entire video? I think I explained it in the video.
Далее
это самое вкусное блюдо
00:12
Просмотров 2,1 млн
My little bro is funny😁  @artur-boy
00:18
Просмотров 4,2 млн
Kubernetes 101 - Episode 7 - Hello, Operator!
39:10
Просмотров 23 тыс.
это самое вкусное блюдо
00:12
Просмотров 2,1 млн