Metacontroller - Custom Kubernetes Controllers The Easy Way

Sdílet
Vložit
  • čas přidán 8. 06. 2024
  • Is Metacontroller the easiest way to create and manage Kubernetes controllers?
    #kubernetes #metacontroller
    Consider joining the channel: / devopstoolkit
    ▬▬▬▬▬▬ 🔗 Additional Info 🔗 ▬▬▬▬▬▬
    ➡ Gist with the commands: gist.github.com/8adaf8fd6496b...
    🔗 Metacontroller: metacontroller.github.io/meta...
    🎬 DevOps MUST Build Internal Developer Platform (IDP): • DevOps MUST Build Inte...
    🎬 Crossplane - GitOps-based Infrastructure as Code through Kubernetes API: • Crossplane - GitOps-ba...
    🎬 Terraform vs. Pulumi vs. Crossplane - Infrastructure as Code (IaC) Tools Comparison: • Terraform vs. Pulumi v...
    🎬 How To Apply GitOps To Everything - Combining Argo CD And Crossplane: • How To Apply GitOps To...
    🎬 How To Shift Left Infrastructure Management Using Crossplane Compositions: • How To Shift Left Infr...
    🎬 Cloud-Native Apps With Open Application Model (OAM) And KubeVela: • Cloud-Native Apps With...
    🎬 Combining Argo CD (GitOps), Crossplane (Control Plane), And KubeVela (OAM): • Combining Argo CD (Git...
    🎬 Should We Replace Docker Desktop With Rancher Desktop?: • Should We Replace Dock...
    ▬▬▬▬▬▬ 💰 Sponsoships 💰 ▬▬▬▬▬▬
    If you are interested in sponsoring this channel, please use calendly.com/vfarcic/meet to book a timeslot that suits you, and we'll go over the details. Or feel free to contact me over Twitter or LinkedIn (see below).
    ▬▬▬▬▬▬ 👋 Contact me 👋 ▬▬▬▬▬▬
    ➡ Twitter: / vfarcic
    ➡ LinkedIn: / viktorfarcic
    ▬▬▬▬▬▬ 🚀 Courses, books, and podcasts 🚀 ▬▬▬▬▬▬
    📚 Books and courses: www.devopstoolkitseries.com
    🎤 Podcast: www.devopsparadox.com/
    💬 Live streams: / devopsparadox
    ▬▬▬▬▬▬ ⏱ Timecodes ⏱ ▬▬▬▬▬▬
    00:00 Introduction To Kubernetes CRDs And Controllers
    05:02 Kubernetes Custom Resource Definitions (CRDs)
    11:26 Custom Kubernetes Controllers
    19:23 Metacontroller In Action
    26:05 Metacontroller Pros And Cons
  • Věda a technologie

Komentáře • 33

  • @DevOpsToolkit
    @DevOpsToolkit  Před rokem +12

    What do you think of Metacontroller? Does it motivate you to create your own Kubernetes controllers?

    • @rafhue
      @rafhue Před rokem +1

      Thanks for your videos ! This one make sense for me that let us a little more freedom to customize k8s behavior.

  • @frangalarza
    @frangalarza Před rokem +7

    I've been trying to replicate this behaviour with a combination of Crossplane, Helm, Kustomize and custom code and gave up due to the sheer pain.
    As you mentioned in your IDP video, our job is to make the platform easy to consume. But if it takes us 3 months to write an operator then we are slowing down the business and we have failed.
    Speed of development is important. Metacontroller looks promising in that regard, specially because you can use a language you already know. This is important too due to the current market conditions where specialized engineers are hard to find and hire. Not many people are proficient in Golang, but you can tap into the fact that the entire internet runs on Javascript and find great developers that can write competent operators in TypeScript, giving you the best of both worlds ♥

  • @itamarmarom7550
    @itamarmarom7550 Před rokem +8

    As someone who knows Kubebuilder pretty good, and after seeing this video I'll say this:
    Metacontroller seems to be very simple from the perspective of code and integrating with Kubernetes. But, it is not mature enough for even a bit more complicated use cases.
    Kubebuilder has some great features that are very important:
    - You are describing the API (CRD) as a go struct. That's good because: kubebuilder generates for you the CRD YAMLs, and you can use your CRD in your code easily, and also let other controllers or code integrate with your CRD by importing your package.
    - Kubebuilder generates almost everything for you starting from the CRD API and YAMLs, the controller integration with the manager, and Kubernetes (you only need to write your code in one `reconcile` function)
    - Generates for you the entire code + YAMLs for deploying admission controllers to mutate/validate requests
    - Easy debugging, you can run your controller locally against a Kubernetes cluster
    - Easy to communicate with every Kubernetes resource (just get the right package)
    - Amazing Makefile to generate code and manifests, easy to build and deploy locally and remotely
    and much more.
    I don't see Metacontroller even close to Kubebuilder currently...

  • @dirien
    @dirien Před rokem +2

    Now you spark my interest! Rarely see you so happy about a project! Thanks Viktor for the video!

    • @DevOpsToolkit
      @DevOpsToolkit  Před rokem +1

      See you in a couple of weeks in Edinburgh :)

  • @popovicmiro
    @popovicmiro Před rokem +2

    Tnx from Dataverse!

  • @felipeozoski
    @felipeozoski Před rokem +1

    Awesome channel ❤

  • @lingxiankong4791
    @lingxiankong4791 Před rokem +2

    Thanks for sharing this! Looks like Metacontroller is aiming at dealing with simple use cases, however, for those simple cases, using Argo Events & Workflows should be a better option IMHO.

    • @DevOpsToolkit
      @DevOpsToolkit  Před rokem +2

      Whether the use case is simple or not depends on what you have as the code of the controller.
      Argo events and workflows are very different. Neither of them allows creation of controllers associated with custom CRDs.

  • @alexandrgumeniuc431
    @alexandrgumeniuc431 Před rokem +2

    Thank you for the review, Victor.
    According to the guide, CompositeController object can watch only one parentResource and that is a big disadvantage comparing to kubebuilder.

    • @DevOpsToolkit
      @DevOpsToolkit  Před rokem

      Oh yeah. That's one (not the only one) disadvantage. Even though I never have more than one parent resource, I can imagine that others do.
      Ultimately, I don't think that Metacontroller will ever be on-par with KubeBuilder. Its focus is on simplicity and being language agnostic. That is sometimes an advantage, while at other times insuficient. It all depends on what one needs.

  • @LazarTas
    @LazarTas Před rokem +1

    Nice. Which cluster are you using on Mac? Kind, minikube?

    • @DevOpsToolkit
      @DevOpsToolkit  Před rokem +1

      I use Rancher Desktop exclusively. You'll find a couple of videos about it on this channel.

  • @KrishP17
    @KrishP17 Před 3 měsíci +1

    Hey, your videos are amazing. I've been trying to build my own custom K8S controller which imitates the dynamic port changing behavior like Rancher (a Kubernetes management platform). What are your suggestions on it? Can you please guide me?

    • @DevOpsToolkit
      @DevOpsToolkit  Před 3 měsíci

      I'm not sure I understood. What should that controller do?

  • @manitaggarwal
    @manitaggarwal Před rokem +1

    When composite controller is hitting the webhook url, what fields is it sending? How to know that?

    • @DevOpsToolkit
      @DevOpsToolkit  Před rokem

      Which composite controller is hitting the webhook is available in the logs of the controller itself. There might be other places, but, if there are, I don't know about them.
      The fields that it is sending are the fields of the payload augmented with the info from the API itself (e.g., operation).
      That being said, Metacontroller has a way to go in that area. Debugging (in general) is far from being good.

    • @manitaggarwal
      @manitaggarwal Před rokem

      @@DevOpsToolkit How did you figure out the fields from request in app.py like image, port, etc?

    • @DevOpsToolkit
      @DevOpsToolkit  Před rokem

      Sorry for not responding earlier. CZcams "decided" to block quite a few messages and I did not see this one until now.
      Typically, you know what the fields are from the spec. That spec might be coming from Kubernetes itself if it's baked in (e.g., kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/), third-party CRDs, or yourself if you created the CRD. Also, besides the documentation, you can always output the request and see what it contains.

  • @ihorpysmennyi2559
    @ihorpysmennyi2559 Před rokem +1

    Are there any advantages Metacontroller compared with Kopf?

    • @DevOpsToolkit
      @DevOpsToolkit  Před rokem

      I haven't used kopf (yet) so I cannot compare those two :(

  • @rubbercable
    @rubbercable Před rokem +3

    How is metacontroller different from Operators?
    It looks simpler - but does it do polling .. or is it only external event driven?
    I worked so hard to learn to golang and kubebuilder.
    😑

    • @DevOpsToolkit
      @DevOpsToolkit  Před rokem +2

      It's a simple way to create a controller that triggers events to other processes. It's not a replacement for KubeBuilder but, rather, an easier (more convenient) way to create controllers or, to be more precise, to avoid creating boiler-plate code.

    • @Jarek.
      @Jarek. Před rokem +3

      I tend to say that what was presented here is more an Operator. Looking at this definition: An operator is a specialized form of controller. Operators implement the controller pattern, meaning they move the cluster towards a defined state, but they possess some extra characteristics too. Operators are tailored to specific applications. They add Kubernetes API extensions via *custom resource definitions* , creating new object types that are used by the application they manage

    • @DevOpsToolkit
      @DevOpsToolkit  Před rokem +2

      Metacontroller is not focused (only) on managing the state. In the nutshell, it help with triggering events into a process that does whatever you'd like it to do. In a way, it removed the need to create the booler-plate code and leaves you to focus exclusively on the code that will be executed as a result of some event.

    • @rubbercable
      @rubbercable Před rokem +1

      Yup. It looks more like an admission/mutation controller.
      The Golang heels like syntactic sugar.
      I like it, but definitely not operator functionality.(No constant reconcile phase)

    • @DevOpsToolkit
      @DevOpsToolkit  Před rokem +1

      @@rubbercable That's correct. There is no constant reconcile phase unless you implement it in your code, which might not be the best idea. Using KubeBuilder makes more sense for those use-cases.

  • @__noob__coder__
    @__noob__coder__ Před 7 měsíci +1

    I just noticed you have such thin eyebrows!!