• Operator-SDK: Set custom fields for kubectl get

    2 min read

    Kubernetes Operator-SDK CustomResourceDefinition additionalPrinterColumns get fields

    When writing a custom Kubernetes operator using operator-sdk we might want to change the fields are show when running kubectl get:

    $ kubectl get example
    NAME   AGE
    demo   4h20m
    

    To do so, we'll need to add the additionalPrinterColumns field the the CustomResourceDefinition, but since we are using operator-sdk to take care of this, we'll need to use some annotations in the resource definition file.

    15/05/2023

    Read more...
  • Kubernetes: Generate a CRD definition from an object

    2 min read

    Kubernetes CRD generator

    Let's face it, manually define a openAPIV3Schema definition is no easy task, so why not automating it? We can use this online CRD generator to be able to create it's definition from one sample object

    21/11/2022

    Read more...
  • Simulate a OpenShift cluster using CRD objects

    3 min read

    OpenShift Kubernetes CRD

    Openshift has some objects that doesn't exists on Kubernetes such as Project or Route. If we try to push one of these OpenShift objects into a vanilla Kubernetes we'll get an error:

    $ kubectl apply -f route.yaml
    error: resource mapping not found for name: "demo-route" namespace: "" from "route.yaml": no matches for kind "Route" in version "route.openshift.io/v1"
    ensure CRDs are installed first
    

    For CI/CD we might not need a fully features OpenShift cluster, just being able to push the objects might be enough, with the CRD generator we can create the needed CRDs to be able to create these OpenShift objects

    17/10/2022

    Read more...

From pet to cattle
Treat your kubernetes clusters like cattle, not pets