Тёмный

Kubernetes CRDs (Custom Resource Definitions) and CRs (Custom Resources) explained, with examples 

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

In this video I talked about what are Kubernetes Custom Resources and how we can create or register them with API Server using Custom Resource Definition.
We also looked into a use case of Custom Resource a explored how actually a new endpoint is registered in the API Server when we create the CRD.
We also looked into Custom Resource field pruning and and status sub resource.
Web:
viveksingh.dev/
00:00 Introduction
00:18 Agenda
00:30 What are Kubernetes Custom Resources (CRs)
01:30 How to create (register) a Custom Resource
02:15 How exactly custom resource is registered in API Server
05:54 How a specific request is handled by API Server layers
07:10 Just creating Custom Resource would just store it in K8S Data Store
08:30 Use Case of Custom Resources
11:13 Look into manifest of Custom Resource Definition (Name and Schema)
13:21 Register different versions of CR in the same group
13:53 Open API Schema specification and validation using CRD
16:18 Register different versions of CR in the same group (Revisit)
17:07 Register a Custom Resource by creating CRD
22:09 Custom Resource field pruning
24:06 Custom Resource Scopes
24:51 CRD Schema Validation and Format
26:23 Combination of Custom Resource and Custom Controllers
26:50 Status Sub Resources
31:30 Conclusion, Like and Subscribe

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

 

30 июн 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 101   
@andreipoehlmann913
@andreipoehlmann913 3 года назад
Thank you, Vivek, for this tutorial. I'm completely new to k8s and this video is really useful. It's hard to find videos/articles that go that deep into k8s. I have a few questions: 1. At min 6:00+ you explain how specific requests are handled by the API server layers. I googled a bit but couldn't find anything useful in this regard. Do you maybe have some links that provide info to what you explained there? Or did you figure this all out by yourself by digging through the source code? 2. You mention that there can be different versions with different schemas, e.g. a newer schema might have additional fields not supported by an older version. Is it possible to run objects of both versions in your cluster side by side? Or do you have to somehow migrate older objects to the new version? 3. In your last section regarding sub resources, I couldn't completely follow along. You pick as en example the sub resource "status". What confuses me is that inside your CRD, there is also a "status" section: that status there is not sub resource, is it? If not, how do you actually define it? Again, really appreciate your video and your explanations.
@viveksinghggits
@viveksinghggits 3 года назад
Hi Andrei, First of all thanks for the appreciation, I really appreciate it. Those are great set of questions that you asked. Let me try to answer them one by one 1. This thing is explained very well in the book "Programming Kubernetes" at the very start of the chapter 4. So first steps/layer (aggregator) is responsible to reply for the resources that are introduced by writing a custom API Server (we can do that). If the resource that we requested is not there, the request will be forwarded to another layer that responds for the k8s native objects and if the resource are not found there as well, apiextensions will, that is responsible to respond for CRDs will respond. If even api extensions is not able to respond to the resource, client would get 404. 2. Per my understanding (I might be a bit off here), If the resource is persisted in the etcd in that case administrator will have to somehow migrate the resource, but client-go library that we use to talk to API Server should be able to do the conversion on the fly. So if a resource is available in two versions, let's say v1beta1 and v1, and that resource is created using apiVersion v1beta1, we would be able to get that by apiVersion v1 as well. Or in other words that resource would be available in apiVersion v1 as well. 3. Subresources are as the name suggests another nested endpoints to main resources, for example logs are not resources but pods' logs can be requests by calling logs sub resouce on pod resources. So the endpoint would look somewhat like /api/v1/namespace/namespace/pods/name/logs If you have a resource that is being handled by a controller once the things, that a controller is supposed to do, are done; it (controller) should be able to update the status for the resource. And that is where subresource comes into picture. If we introduce sub resource for ETCD CRD let's say, in that CRs for ETCD are going to have status sub resource that can be updated by controller/operator. This again is explained in great detail in the same book same chapter, under heading Status Subresource. I hope this helps, let me know if something else needs to be discussed. I would be happy to discuss that. Another thing that I wanted to ask is, can post you comment on my twitter with you name, this is really a great comment Andrei.
@andreipoehlmann913
@andreipoehlmann913 3 года назад
​@@viveksinghggits Thanks for your reply, really appreciate it. I'll definitely check out the book you mentioned. I've been reading "mastering Kubernetes" and been also considering to look into "Kubernetes in practice" but I guess now you convinced me to also have a look at "Programming Kubernetes". Regarding twitter, sure. Just let me know your twitter ID (maybe you want to add to your video descriptions?).
@viveksinghggits
@viveksinghggits 3 года назад
Hey 👋, I am at viveksinghggits on Twitter.
@viveksinghggits
@viveksinghggits 3 года назад
Ohh damn, If I re-read the comment again, that is not what I meant. I wanted to ask your permission to tweet this screenshot.
@mohanchinna5494
@mohanchinna5494 3 года назад
@@viveksinghggits I was trying to create CRD for OpenShift Container Storage which contains worker node info and provisioner details. Can I get help on it?
@pruthvi7798
@pruthvi7798 Месяц назад
Great video, cleared most of my confusion. Thank you
@viveksinghggits
@viveksinghggits 25 дней назад
Thank you. I am glad it helped.
@niteshsince1982
@niteshsince1982 3 года назад
Very complicated topic, nicely explained. I learned a lot from this video. Thanks.
@viveksinghggits
@viveksinghggits 3 года назад
Hey 👋, Thanks Nitesh, I really appreciate it. 🙏
@m.tarkeshwarrao9105
@m.tarkeshwarrao9105 2 года назад
Thanks Vivek for your contribution towards new learners. Keep it up
@viveksinghggits
@viveksinghggits 2 года назад
Thank you.
@SureshKumar-ch3df
@SureshKumar-ch3df 3 года назад
Clear explanation given, Thank you Vivek.
@viveksinghggits
@viveksinghggits 3 года назад
Thanks for watching Suresh.
@rayehan30
@rayehan30 3 года назад
Thank you, Vivek. You're a superman....your video has helped me a lot.
@viveksinghggits
@viveksinghggits 3 года назад
Haha, thanks Rayehan. I appreciate 🙏 it.
@sasmalpayal
@sasmalpayal 3 года назад
I really appreciate your efforts. I have learnt a lot. Thank you so much
@viveksinghggits
@viveksinghggits 3 года назад
Hi 👋 Payal, Thank you for the kind words, I appreciate it.
@user-pu1hi3hk5j
@user-pu1hi3hk5j 2 года назад
Very clear and easy to understand Thanks for your video
@viveksinghggits
@viveksinghggits 2 года назад
Thank you for watching.
@hashilbh5654
@hashilbh5654 3 года назад
No words, this is Amazing. Actually i am watching first time about crd and its gonna be simply understood🙂
@viveksinghggits
@viveksinghggits 3 года назад
Hey 👋, Thanks Hashil, I am glad it was helpful.
@hashilbh5654
@hashilbh5654 3 года назад
@@viveksinghggits very much helpful. keep going
@viveksinghggits
@viveksinghggits 3 года назад
Sure, thank you.
@anthonyakhil2169
@anthonyakhil2169 3 года назад
Thanks Vivek, finally got a clarity on this.
@viveksinghggits
@viveksinghggits 3 года назад
Hey 👋, Thank you.
@viveksinghggits
@viveksinghggits 3 года назад
I am glad it helped.
@oferlahav3650
@oferlahav3650 3 года назад
Another excellent video :-)
@viveksinghggits
@viveksinghggits 3 года назад
Thanks Ofer
@swapnilhajare5557
@swapnilhajare5557 Год назад
Amazing explanation thanks for the video.
@viveksinghggits
@viveksinghggits Год назад
Thank you for watching.
@navnathdahibhate2464
@navnathdahibhate2464 2 года назад
Nice explanation on CRD !!
@viveksinghggits
@viveksinghggits 2 года назад
Thank you.
@utwonics
@utwonics 2 года назад
Very good Vivek.
@twentythirtyforty
@twentythirtyforty 3 года назад
very helpful! thanks!
@viveksinghggits
@viveksinghggits 3 года назад
Thank you 😊
@suyashdubey520
@suyashdubey520 2 года назад
Great explanation!
@viveksinghggits
@viveksinghggits 2 года назад
Thank you 😊
@siddharathadhumale3683
@siddharathadhumale3683 2 года назад
Simple and sweet :)
@viveksinghggits
@viveksinghggits 2 года назад
Thank you 😊.
@manasjain914
@manasjain914 3 года назад
Great Content
@viveksinghggits
@viveksinghggits 3 года назад
Hey 👋, Thanks Manas.
@Brofabloke69
@Brofabloke69 2 года назад
this is really good
@viveksinghggits
@viveksinghggits 2 года назад
Thank you.
@shikharjoshi267
@shikharjoshi267 3 года назад
this is gold
@viveksinghggits
@viveksinghggits 3 года назад
Damn. Thanks Shikhar 😊🙏 I really appreciate it.
@vaibhavpande5585
@vaibhavpande5585 Год назад
great explaination
@viveksinghggits
@viveksinghggits Год назад
Thank you
@thefullmoonlight
@thefullmoonlight 2 года назад
this is good explanation. i am subscribing and watching out for more videos bro
@viveksinghggits
@viveksinghggits 2 года назад
Thank you.
@perplexedbot
@perplexedbot Год назад
this is good one i was so confused between CRD and CR
@viveksinghggits
@viveksinghggits Год назад
Thank you 😊.
@emmalu3891
@emmalu3891 Год назад
Thank you so much for making this video. It was really helpful and clear. It would be nice if you could make a video on how to add logic to a CRD also :)
@viveksinghggits
@viveksinghggits Год назад
Hi Emma, Thank you for the kind words. I am assuming you meant writing an operator for the custom resources, if yes, I already have a video where I wrote a controller/operator for custom resource. If you meant something else, can you please explain what exactly you meant by add logic to CRD.
@viveksinghggits
@viveksinghggits Год назад
This is the video about custom controller that I talked about Writing K8S Operator (Kluster): ru-vid.com/group/PLh4KH3LtJvRTtFWz1WGlyDa7cKjj2Sns0
@user-ug7ue8xw5b
@user-ug7ue8xw5b Год назад
Nice Explanation
@viveksinghggits
@viveksinghggits 10 месяцев назад
Thank you
@chandrasekharreddyp
@chandrasekharreddyp 2 года назад
very helpful.!
@viveksinghggits
@viveksinghggits 2 года назад
Thank you.
@shakilmakram6923
@shakilmakram6923 3 года назад
good info, thanks!
@viveksinghggits
@viveksinghggits 3 года назад
I am glad you liked them 😊
@shakilmakram6923
@shakilmakram6923 3 года назад
@@viveksinghggits next video this topic out yet?
@viveksinghggits
@viveksinghggits 3 года назад
I am planning to make a video on setting up a kubernetes cluster using kubeadm.
@sriramashwin9871
@sriramashwin9871 Месяц назад
Nice video Vivek, really helped me a lot. Also, I want to read further about CR and CRDs so can anyone help me with some resources for it?
@orrymr
@orrymr 3 года назад
Nice video
@viveksinghggits
@viveksinghggits 3 года назад
Hey 👋, Thanks Orry.
@user-ef1co7pb3l
@user-ef1co7pb3l 8 месяцев назад
Hi Vivek, thanks for the excellent video , it was really very helpful, can you please share some info on CRDs with namespace and cluster scope, what is the difference , and how we create instances of them
@viveksinghggits
@viveksinghggits 8 месяцев назад
Hi Madhur, While registering new resources using CRD, we can configure if the new resource is going to be namespace scoped or cluster scoped. Like the name suggests if a CRD is registering a CR that is namespace scoped, it would mean that when we create the new resource we can specify which namespace that new resource should be created in. Similarly cluster scoped resource is not contained within a namespace like storage class etc. In other words it’s not different from how Kubernetes native cluster and namespace scoped resources behave.
@moudjermohamed2844
@moudjermohamed2844 2 года назад
hello Vivek, thnk you so much....very helpful videos. would you please make one video about "daemonsets"
@viveksinghggits
@viveksinghggits 2 года назад
Hi Moudjer, Thank you. I don't have plans right now, to make that video but let's see if I can create one in future.
@rohan_dsouza
@rohan_dsouza 2 года назад
Really good video. A very complex topic explained very well. Have you yet created a video on CRC's ?
@viveksinghggits
@viveksinghggits 2 года назад
Hi Rohan, I am not very comfortable with CRCs, so I don't have a plan to make that video. I am assuming you are talking about code ready containers.
@rohan_dsouza
@rohan_dsouza 2 года назад
Sorry, i meant custom resource controllers.
@viveksinghggits
@viveksinghggits 2 года назад
I think this is what you are talking about Writing K8S Operator (Kluster): ru-vid.com/group/PLh4KH3LtJvRTtFWz1WGlyDa7cKjj2Sns0
@parshuramgurav6372
@parshuramgurav6372 2 года назад
Thank you for making a video on such an important topic, just one question, when kubectl proxy is running, you send requests to the API over the localhost on the default proxy port 8001 (from another terminal, since the proxy locks the first terminal when running in foreground) however this port is not open on my VM (not included in my firewall rules) How do we access to port 8001 with a proxy server even when it's not open?
@viveksinghggits
@viveksinghggits 2 года назад
Hi Parshuram, You can specify the port to kubectl proxy command using --proxy flag. So if there is something already running on port on your machine you can always use another port using above mechanism. More details are here kubernetes.io/docs/tasks/extend-kubernetes/http-proxy-access-api/#exploring-the-kubernetes-api Let me know if this doesn't help.
@pawand4831
@pawand4831 Год назад
Is there a way to extend/add custom resources to existing Pod interface without meddling with how a Pod gets deployed ? These custom resources would be provisioned and their status will be updated by a custom controller. I was trying to add my own secrets CRD to the pod interface. Would kubernetes allow updates Pod status by custom controllers ? Is that a thing ? Thanks you for all the great work you do. I cant stress it enough on how helpful and detail they are while being to the point
@viveksinghggits
@viveksinghggits Год назад
Hi Pawan, I didn't understand the question correctly. What do you exactly mean by add custom resource to existing pod interface? Also, later you asked if custom controller would be able to update the pod status, the answer is yes. As long as the controller has authz to update the status, it should be able to.
@rajat420420
@rajat420420 2 года назад
@22.13 timestamp at line 6 if I want to update members value t6 from 3 how can I do that using kubectl command?
@viveksinghggits
@viveksinghggits 2 года назад
Hey Rajat, I am assuming you want to update a specific field of a custom resource using kubectl. One thing I can think of right now is, creating a kubectl plug-in that would take members value and custom resource name and update the resource with the given value.
@rajat420420
@rajat420420 2 года назад
@@viveksinghggits I want to update using kubectl patch command
@viveksinghggits
@viveksinghggits 2 года назад
Aah makes sense. Did you try doing that, what is the problem? I don't remember the command ready.
@rajat420420
@rajat420420 2 года назад
@@viveksinghggits something like this kubectl patch crd functions -n default --patch '{"spec":{ InvokeStrategy: 5 }}'
@athiqrahman818
@athiqrahman818 2 года назад
can you publish your yaml file on something like gihub? that way can follow along
@viveksinghggits
@viveksinghggits 2 года назад
Hi Athiq, I usually push the code that write in the videos but I think I don't push the manifests. Maybe I will try to do that in coming videos.
@shamstabrez2986
@shamstabrez2986 Год назад
brother wht do u mean by member here in crd definition
@viveksinghggits
@viveksinghggits Год назад
Can you mention the timestamp please. Where exactly I am talking about member.
@shamstabrez2986
@shamstabrez2986 Год назад
@@viveksinghggits its present in crd configuration file members: 3 like this
@vyomyadav6497
@vyomyadav6497 Год назад
I get what you are trying to say, but an etcd CRD is not possible IMO. Where would you store the CRD definition for etcd, it's like a self dependency which I don't think is possible. The idea of introducing a new peer to etcd setup may be possible after setting up the leader. I get what you are trying to say, but be careful with the examples :)
@viveksinghggits
@viveksinghggits Год назад
Do you want to talk about it, in a Twitter space?
@vyomyadav6497
@vyomyadav6497 Год назад
@@viveksinghggits Not right now, but yeah, I am up for talking about k8s.
@viveksinghggits
@viveksinghggits Год назад
Sure, whenever. I am not challenging you or anything. Its just that I would understand your point of view and opinion. What's your Twitter handle?
@renefleischhauer8322
@renefleischhauer8322 3 года назад
Is it just me, or does also somebody else have trouble reading the handwriting?
@viveksinghggits
@viveksinghggits 3 года назад
Hey Rene, I am sorry about that, yeah the handwriting is not readable, it's bad. I usually try to not write important things there. But I will try to make that better for sure. Thank you.
@renefleischhauer8322
@renefleischhauer8322 3 года назад
@@viveksinghggits Thanks your reply. I really had problems to decode your writing. Maybe you can type a bit more. Anyway, good video and explanation nevertheless! 👍
@viveksinghggits
@viveksinghggits 3 года назад
Thanks Rene, I appreciate it. Yeah, I will try to type more and improve writing as well.
@shamstabrez2986
@shamstabrez2986 Год назад
bhai kya bolre ho kuch smjh nhi ara ye lekr teesra br sunra hoon
@viveksinghggits
@viveksinghggits Год назад
Hi Shams, That's not really a useful feedback. I don't know what should I do about your comment. 1. Is the audio quality too bad? 2. Is the way I speak is so bad that you are not able to understand 3. Or the sentences that I am saying are not making any sense
@shamstabrez2986
@shamstabrez2986 Год назад
@@viveksinghggits 3 one
@viveksinghggits
@viveksinghggits Год назад
Give me an example of what's not making sense. So that I can understand if its grammatical mistake that's causing the problem or something else.
Далее
Stray Kids <ATE> UNVEIL : TRACK "MOUNTAINS"
00:59