Writing a Kubernetes custom controller (ekspose) from scratch to expose your deployment | Part - 1

Поделиться
HTML-код
  • Опубликовано: 28 ноя 2024

Комментарии • 61

  • @rajatnigam905
    @rajatnigam905 3 года назад +7

    This video is rare content available on RUclips. The concepts are explained in-depth, backed by the implementation that made it simple to understand.

    • @viveksinghggits
      @viveksinghggits  3 года назад +1

      Thank you so much Rajat for the kind words.
      We will be hosting a Twitter spaces around the exact same topic, tomorrow 7PM IST. Do join if you have some time.

  • @MVybz
    @MVybz 2 года назад +3

    Hi Vivek, I am still fairely new to golang but I am learning so much from watching your videos!
    These videos are extremely rare to come across.
    I would love to see more videos like this, especially where you create a new project from scratch, I can only speak for myself but I seem to learn the most when I get to see the whole process from the start. ✌

    • @viveksinghggits
      @viveksinghggits  2 года назад +1

      Hi,
      Thank you for the kind words 🙏. I do have some other videos in the channel where I created the projects from scratch. I hope you would like them as well.

  • @testuserselvaraj
    @testuserselvaraj 3 года назад +1

    Thanks for making this series on custom controllers learning and understanding a lot through your videos and code, now waiting for part 2 with ingress :)

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Thanks Selva. Sure, the ingress one is actually going to be more interesting.

  • @simeonpoot19
    @simeonpoot19 Год назад

    Hi Vivek, first of all, thank you for all the work you've done explaining the concepts and workings of Informers, controllers and so on.
    I was wondering if you could explain 2 things to me:
    1) how can I implement a retry (exponential backoff?), I've got a certificate (cert-manager) that I'm currently creating a controller on, but sometimes I need to retry the same certificate (object from the cache).. how can I do this properly, without calling the apiserver for this particular object.
    2) I can't wrap my head around the difference between Informer and sharedInformer, can you elaborate on this?

    • @viveksinghggits
      @viveksinghggits  Год назад

      Hi Simeon,
      Thank you. I think if you use one of the frameworks to the create the controller, there are ways in built to retry with exponential back off.

  • @dulcepromisco8680
    @dulcepromisco8680 3 года назад +1

    Hi Vivek Singh, thank you for your video, I hope you can give more learning examples of K8S development later. In addition, I have a question 🤔️. Normally, we will declare that SVC and Ingress are exposed through YAML. Now what we're doing with the custom controller is we're going to let the SVC and the ingress have the custom controller implement it,Right? But what I really want to say is, does this help us any better, is this the concept of CRD without having to rely on operators to implement it? Wouldn't it be easier to automate our example for the operator? Okay, so this looks like it needs to be understood, so is it convenient for you to answer

    • @viveksinghggits
      @viveksinghggits  3 года назад +1

      Hey,
      Thanks for the question. Sorry for being late, I tried to paste this earlier but RUclips messed up.
      "Normally, we will declare that SVC and Ingress are exposed through YAML." -> It doesn't actually matter if we are creating the resources either using YAML or using Go struct, the actual controller that are responsible to work on creation on those resources will work on both of them.
      "is this the concept of CRD without having to rely on operators to implement it?" -> No, if you notice we didn't even talk about CRDs here. All we did is listen of deployment (native resource) and as soon as a deployment resource is created, create service and ingress resources automatically.
      So if I try to summarise it, if we don't even talk about our controller, if we create service, service controller is responsible to do the things. Similarly, if we create ingress resource ingress controller (that we install manually), takes care of that. Now the important thing is it doesn't matter how those resources (service and ingress) are not being created.
      So even though we created the service and ingress resources using go code we are going to have the same effect as we we created it through YAML, or in other words same service controller and ingress controler are going to be responsible there.
      Please don't hesitate to ask if you have any other doubts.

  • @dulcepromisco8680
    @dulcepromisco8680 2 года назад +1

    Current experiments can listen for deployment changes of all namespaces. How can I listen for deployment changes of a specified namespace

    • @viveksinghggits
      @viveksinghggits  2 года назад +1

      That's a really great question Dulce. So if you see the code right now we are using NewSharedInformerFactory to create the informer factory that by default considers all the namespaces.
      But if you want to create informer factory with certain customization you should use NewSharedInformerFactoryWithOptions function from the same source file. This new function.
      NewFilteredSharedInformerFactory is another function that can be used but is deprecated in favor of NewSharedInformerFactoryWithOptions.
      Let me know if this answers your question if not we can continue the discussion here.

  • @projalin5712
    @projalin5712 2 года назад +1

    Gi vivek, in which video you have explained about the first peace of go code that you copied and pasted?? Will be helpful thank you

    • @viveksinghggits
      @viveksinghggits  2 года назад

      First video of this playlist. You can go to my channel and click on playlist to see all the playlists.

  • @shubhamyelikar5530
    @shubhamyelikar5530 3 года назад +1

    Hi Vivek,
    Which way is better for writing custom controllers,
    - we can also write using kubebuilder which generates scaffolding for us
    - or the one which you mentioned in video.
    Also can you also create video on writing controller using kubebuilder.

    • @viveksinghggits
      @viveksinghggits  3 года назад +1

      Hi Shubham,
      I have seen people either using kubebuilder or operator sdk to write controller/operator on production.
      I made this video so that people would get to understand what exactly happens behind the scenes.

  • @RadhamaniRamadoss
    @RadhamaniRamadoss Год назад

    Really very useful..thankyou for this wonderful educational videos

  • @mahdibouaziz5353
    @mahdibouaziz5353 2 года назад

    YOU ARE AMAZING !!!! THANK YOU FOR THIS VIDEO

  • @robl39
    @robl39 3 года назад

    Nice video! On a side note, I don’t get how so many people seem to like Go. In my opinion, the syntax is very confusing.

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Thanks Rob, so a lot of people actually find Go to be a pretty decent language to get started with.
      The only problem that I faced and heard people complaining about is dependency management in Go.

  • @gaganak9025
    @gaganak9025 2 года назад +1

    Hey Vivek, Love the content that you are creating. I was trying to create a controller using kubebuilder tool, But was not able to do without a custom resource. Is it possible to create a similar controller as this video on kubebuilder?

    • @viveksinghggits
      @viveksinghggits  2 года назад

      Hi Gagana,
      By a quick look at kube builder github repo it looks like we can not generate controller code for k8s native resources using kube builder. We can just create API for custom resources using kube builder.
      But I don't think there is a lot of code that that we need to generate in case of controllers for native resources so there isn't much use case for using a framework there.
      But in case of CRDs there is some significant amount of code that needs to be generated and because of some other reasons we need a framework like kube builder or operator sdk.

    • @AshwaniSharma0207
      @AshwaniSharma0207 2 года назад

      Hi It can be done using following command:
      kubebuilder create api --group core --version v1 --kind Pod
      and on prompt for Create Resource, enter "n"

  • @algorithmimplementer415
    @algorithmimplementer415 3 года назад +1

    Could not we have auto-suggestion in your editor? Maybe that could have saved some time having the fact that the video is too long. Anyhow, the video is very helpful. Thank you.

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Hey,
      Auto suggestion usually works for me, but sometimes it doesn't work for me because of go path settings that I have in settings.json because of my office work.
      I will try to improve that though.
      Thank you.

  • @rafaelTomelin
    @rafaelTomelin 2 года назад

    Hi, this an excelent video on RUclips. My question, is possible blocked the create or update deployment or pod if doens't has the specific labe? If is possible, how can I implement?

    • @viveksinghggits
      @viveksinghggits  2 года назад

      Hi Tomelin,
      Thank you for watching. If I understand you correctly, you want to block creation of a deployment if the deployment doesn't have a specific label.
      Yes, it'd possible and we can do this using validating admission controller.

    • @viveksinghggits
      @viveksinghggits  2 года назад

      ruclips.net/video/NRmNE-6Wb7g/видео.html

    • @rafaelTomelin
      @rafaelTomelin 2 года назад

      @@viveksinghggits yes. Because in my company the microservive should be deployed if the GMUD is approved. I want validate the GMUD is approved after validation I release deployment

    • @viveksinghggits
      @viveksinghggits  2 года назад

      Ok, the video link that I shared is going to be helpful to you.

  • @fasid93
    @fasid93 2 года назад

    Excellent content. ❤ Keep up the good work!

  • @diyabasu6402
    @diyabasu6402 Год назад

    Hi, can u make a series on building custom Kubernetes scheduler?

    • @viveksinghggits
      @viveksinghggits  Год назад

      Hi,
      I think I can try that, I can't commit to a timeline though.

  • @sachinshingare9762
    @sachinshingare9762 2 года назад

    Hi Vivek Ji, Is there any good book for Kubernetes programming understanding.

    • @viveksinghggits
      @viveksinghggits  2 года назад

      Programming Kubernetes is pretty good book that you can refer.

  • @MrBaddy12
    @MrBaddy12 Год назад

    Thanks, Vivek, you are awesome

  • @palashgoel8973
    @palashgoel8973 3 года назад

    Thanks for making video on controllers

  • @kevinfernandes4097
    @kevinfernandes4097 3 года назад +1

    Nice videos. Where can i find the code in the videos ?

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Hey Kevin,
      I have mentioned the github repo in the description of the video.

    • @kevinfernandes4097
      @kevinfernandes4097 3 года назад +1

      @@viveksinghggits Thx . Could you also create videos on creating operators with kubebuilder and operator-sdk and providing information regarding best practices ?

    • @viveksinghggits
      @viveksinghggits  3 года назад +1

      I actually have plans to create videos on operators without using these frameworks and then eventually would create videos on those frameworks but unfortunately I don't have a timeline yet.

  • @sankethrd2004
    @sankethrd2004 3 года назад

    Good explanation

  • @crazyUtters
    @crazyUtters 3 года назад

    Good j0b

    • @viveksinghggits
      @viveksinghggits  3 года назад +1

      Thanks KP.

    • @crazyUtters
      @crazyUtters 3 года назад

      I thought writing controllers is tough job, with your video it's looks easy to me..

    • @viveksinghggits
      @viveksinghggits  3 года назад

      It's not that tough but there are a lot of things that we should take care of while writing production level controller.
      And to look into those things we can look into the source code of already written kubernetes Controller for example pv controller.
      I recommend that on one of the videos.

    • @crazyUtters
      @crazyUtters 3 года назад

      @@viveksinghggits how to run custom controller from cluster ???

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Hi KP,
      That is exactly what I am going to cover in next video.

  • @maksymtrofimenko7325
    @maksymtrofimenko7325 2 года назад +1

    Keyboard clacking is killing me...

    • @viveksinghggits
      @viveksinghggits  2 года назад

      Aaah, so sorry about that. It's lesser in newer videos.