0Pricing
DevOps Bootcamp · Lesson

Custom Resource Definitions (CRDs)

Learn how Custom Resource Definitions extend the Kubernetes API with your own resource types, the foundation that Operators build on.

Custom Resource Definitions (CRDs) is a free DevOps Bootcamp lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Extending the Kubernetes API

Built-in objects like Pods and Deployments are not the limit. With a Custom Resource Definition (CRD) you can teach Kubernetes entirely new resource types.

What Is a Custom Resource?

A Custom Resource (CR) is an instance of a type you defined. Once a CRD is installed, you create CRs with kubectl just like native objects.

Anatomy of a CRD

A CRD declares the new kind, its API group, version, and scope (namespaced or cluster-wide).

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: backups.data.example.com
spec:
  group: data.example.com
  scope: Namespaced
  names:
    plural: backups
    singular: backup
    kind: Backup

Defining the Schema

An OpenAPI schema validates the fields of your custom resource, rejecting invalid specs at creation time.

versions:
- name: v1
  served: true
  storage: true
  schema:
    openAPIV3Schema:
      type: object
      properties:
        spec:
          type: object
          properties:
            schedule:
              type: string
            retention:
              type: integer

Creating a Custom Resource

After the CRD is applied, you create instances of your new type.

apiVersion: data.example.com/v1
kind: Backup
metadata:
  name: nightly-db
spec:
  schedule: '0 2 * * *'
  retention: 7

Working with CRs via kubectl

Custom resources are first-class. You list, describe, and delete them with familiar commands.

kubectl get backups
kubectl describe backup nightly-db
kubectl delete backup nightly-db

Short Names and Printer Columns

You can define short names and custom table columns to make CRs pleasant to work with.

names:
  shortNames: ['bk']
additionalPrinterColumns:
- name: Schedule
  type: string
  jsonPath: .spec.schedule

CRDs Are Just Data

By itself, a CRD only stores data in etcd. Nothing acts on it. To make a Backup actually happen, you need a controller watching these resources.

The Link to Operators

An Operator is a controller plus one or more CRDs. The CRD defines the desired state; the controller continuously reconciles reality to match it. CRDs are the foundation Operators stand on.

Versioning CRDs

CRDs support multiple versions with conversion, letting you evolve your API. Exactly one version is marked as the storage version in etcd.

versions:
- name: v1beta1
  served: true
  storage: false
- name: v1
  served: true
  storage: true

When to Use CRDs

  • You want to model a domain concept declaratively (Backup, Database, Certificate)
  • You are building an Operator to automate operations
  • You want users to manage your app with familiar kubectl workflows

Quick Check

Test your CRD understanding.

Recap

You learned that CRDs extend the Kubernetes API with custom types, validated by an OpenAPI schema and managed with normal kubectl commands. A CRD alone just stores data; pairing it with a controller produces an Operator that reconciles desired state.

Frequently asked questions

Is the “Custom Resource Definitions (CRDs)” lesson free?

Yes — the full text of “Custom Resource Definitions (CRDs)” is free to read here on the web, and the DevOps Bootcamp course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the DevOps Bootcamp course, upgrade to CoddyKit PRO.

What will I learn in “Custom Resource Definitions (CRDs)”?

Learn how Custom Resource Definitions extend the Kubernetes API with your own resource types, the foundation that Operators build on. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start DevOps Bootcamp?

No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Custom Resource Definitions (CRDs)” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this DevOps Bootcamp lesson?

Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. StatefulSets for Stateful Apps
  2. DaemonSets for Node-Specific Tasks
  3. Understanding Kubernetes Operators
  4. Custom Resource Definitions (CRDs)
← Back to DevOps Bootcamp