Kubernetes Controllers, Custom Controllers and Operators explained with use cases

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024

ความคิดเห็น • 54

  • @crujzojam7004
    @crujzojam7004 2 ปีที่แล้ว

    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  2 ปีที่แล้ว +1

      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 2 ปีที่แล้ว

      @@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  2 ปีที่แล้ว

      People are moving away from operators to what?

  • @kunchalavikram
    @kunchalavikram 3 ปีที่แล้ว +2

    Well explained. Which device you use for writing and the video recording software that displays the speaker's video?

    • @viveksinghggits
      @viveksinghggits  3 ปีที่แล้ว +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.

  • @Babe_Chinwendum
    @Babe_Chinwendum ปีที่แล้ว

    So so helpful!! Thanks a mil!

    • @viveksinghggits
      @viveksinghggits  ปีที่แล้ว

      Thank you for watching. I am glad they were helpful.

  • @PREETISBAYAS
    @PREETISBAYAS 2 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      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 ปีที่แล้ว +1

      For example entire life cycle of the database or the resources that is being created by operator should ideally be handled by operator.

  • @roshankakad9720
    @roshankakad9720 2 ปีที่แล้ว

    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  2 ปีที่แล้ว

      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 2 ปีที่แล้ว

      @@viveksinghggits Hi Vivek, its still not clear, Please help me understand in other way around.

    • @roshankakad9720
      @roshankakad9720 2 ปีที่แล้ว

      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  2 ปีที่แล้ว

      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 2 ปีที่แล้ว

    bhai toh controllers n operators mein difference kya hua jb dono hi chizen custom resource pr kam krri h

    • @viveksinghggits
      @viveksinghggits  2 ปีที่แล้ว

      The exact same question is answered in the pinned comment.

  • @badmintonSeekers
    @badmintonSeekers ปีที่แล้ว

    Main difference between Controller an Operator ?

    • @viveksinghggits
      @viveksinghggits  ปีที่แล้ว

      Have you watched the entire video? I think I explained it in the video.

  • @gv.ramana
    @gv.ramana 3 ปีที่แล้ว +1

    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.

  • @kingcharles30922
    @kingcharles30922 3 ปีที่แล้ว +2

    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 ปีที่แล้ว +2

      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 ปีที่แล้ว +2

      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.

  • @prasunaneerati5626
    @prasunaneerati5626 3 ปีที่แล้ว +1

    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

  • @adityajoshi3360
    @adityajoshi3360 2 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      @@viveksinghggits yes I have seen that, my question is more toward the operator sdk that allow creating operator with helm

    • @viveksinghggits
      @viveksinghggits  2 ปีที่แล้ว +1

      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 ปีที่แล้ว +1

    How a particular operator attached to particular CR

    • @viveksinghggits
      @viveksinghggits  3 ปีที่แล้ว +1

      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

  • @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  ปีที่แล้ว +1

      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.

  • @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.

  • @shamstabrez2986
    @shamstabrez2986 2 ปีที่แล้ว

    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 2 ปีที่แล้ว

    or do you have any Practical video for operator for my below query as i won't find it

    • @viveksinghggits
      @viveksinghggits  2 ปีที่แล้ว

      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.

  • @basilkurian0
    @basilkurian0 ปีที่แล้ว

    Thanks for making these videos

    • @viveksinghggits
      @viveksinghggits  ปีที่แล้ว

      I am greatful for the super thanks and glad that videos were helpful.

  • @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 ปีที่แล้ว +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.

  • @keratishvili
    @keratishvili 3 ปีที่แล้ว

    Great video would love to see more deep dive materials

    • @viveksinghggits
      @viveksinghggits  3 ปีที่แล้ว +1

      Thanks 😊 Giorgi,
      Yes, I do have some great videos planned for coming weeks.

  • @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.