Member-only story
Kubernetes CronTab CRD Tutorial: Build, Deploy, and Manage Custom Scheduled Jobs
Kubernetes Custom Resource Definitions (CRDs) in Plain and Simple Explanation.
A Custom Resource Definition (CRD) in Kubernetes is a way to extend the Kubernetes API by defining your own resource types, in addition to the built-in ones, such as Pods and Services.
CRD & ConfigMap
A Custom Resource Definition (CRD) and a ConfigMap are both Kubernetes resources, but they serve different purposes. CRD defines new resource types and APIs in Kubernetes, and ConfigMap stores configuration data for applications.
The project
This project defines a Custom Resource Definition (CRD) for managing cron jobs in a Kubernetes cluster. The custom resource is called `CronTab`, which allows users to specify a schedule and a job name for their cron jobs.
main.go
This file sets up a basic Kubernetes controller that watches for changes to CronTab custom resources and prints a message when they change. It’s a starting point for building more advanced automation around your CRD.
package main
import (
"context"
"flag"
"fmt"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"…