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.
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. ✌
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.
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 :)
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?
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.
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
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.
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.
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.
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.
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.
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?
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.
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.
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.
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?
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 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 Thx . Could you also create videos on creating operators with kubebuilder and operator-sdk and providing information regarding best practices ?
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.
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.
This video is rare content available on RUclips. The concepts are explained in-depth, backed by the implementation that made it simple to understand.
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.
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. ✌
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.
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 :)
Thanks Selva. Sure, the ingress one is actually going to be more interesting.
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?
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.
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
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.
Current experiments can listen for deployment changes of all namespaces. How can I listen for deployment changes of a specified namespace
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.
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
First video of this playlist. You can go to my channel and click on playlist to see all the playlists.
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.
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.
Really very useful..thankyou for this wonderful educational videos
Thank you.
YOU ARE AMAZING !!!! THANK YOU FOR THIS VIDEO
Thank you
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.
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.
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?
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.
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"
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.
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.
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?
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.
ruclips.net/video/NRmNE-6Wb7g/видео.html
@@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
Ok, the video link that I shared is going to be helpful to you.
Excellent content. ❤ Keep up the good work!
Thank you Kader.
Hi, can u make a series on building custom Kubernetes scheduler?
Hi,
I think I can try that, I can't commit to a timeline though.
Hi Vivek Ji, Is there any good book for Kubernetes programming understanding.
Programming Kubernetes is pretty good book that you can refer.
Thanks, Vivek, you are awesome
Thank you
Thanks for making video on controllers
👍
Nice videos. Where can i find the code in the videos ?
Hey Kevin,
I have mentioned the github repo in the description of the video.
@@viveksinghggits Thx . Could you also create videos on creating operators with kubebuilder and operator-sdk and providing information regarding best practices ?
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.
Good explanation
Thanks Sanketh
Good j0b
Thanks KP.
I thought writing controllers is tough job, with your video it's looks easy to me..
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.
@@viveksinghggits how to run custom controller from cluster ???
Hi KP,
That is exactly what I am going to cover in next video.
Keyboard clacking is killing me...
Aaah, so sorry about that. It's lesser in newer videos.