> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Resources CRDs for Self Service APIs

> Overview of Kubernetes CustomResourceDefinitions for creating intent-based self-service APIs, covering schema validation, controllers and operators, RBAC, versioning, observability, patterns and best practices

CRDs (CustomResourceDefinitions) let platform teams extend the Kubernetes API with domain-specific resources and intent-based APIs. They are a core building block for platform engineering: expose simple, validated interfaces to developers while platform controllers handle the operational complexity.

CRDs are ideal when you need:

* Domain-specific abstractions (for example: PonyDatabase, Environment, SearchCluster).
* Intent-based APIs that hide low-level objects (Pods, Services, PVCs).
* Server-side validation, kubectl integration, discovery, and RBAC control.

Key capabilities of CRDs:

* Define new Kubernetes-like resource types with `kind`, `apiVersion`, and REST endpoints.
* Enforce validation using OpenAPI v3 schemas.
* Integrate with standard tooling (kubectl, API discovery) and RBAC.
* Serve as the contract that controllers use to reconcile desired state to actual cluster resources.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/0r3GTobZImleUlJh/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/kubernetes-crds-schema-api-kubectl-validation.jpg?fit=max&auto=format&n=0r3GTobZImleUlJh&q=85&s=d4fc7fd6c3ab0b5f0e425455135711f6" alt="A presentation slide titled &#x22;CRDs — Extending Kubernetes With Custom APIs&#x22; showing four colored boxes: Schema Definition, API Extension, kubectl Integration, and Validation. Each box has a short caption about defining new resource types, creating custom endpoints, using standard Kubernetes tools, and built-in schema/OpenAPI validation." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/kubernetes-crds-schema-api-kubectl-validation.jpg" />
</Frame>

<Callout icon="lightbulb" color="#1CB2FE">
  CRDs provide the API surface and validation. To make a CRD functional you normally implement a controller or operator that watches custom resources and performs provisioning, lifecycle management, and reconciliation.
</Callout>

## Basic CRD example

Below is a minimal, valid CRD that defines a namespaced `PonyDatabase` resource with a simple OpenAPI v3 validation that restricts the `size` field to `small | medium | large`:

```yaml theme={null}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: ponydatabases.platform.sparkleponyranch.com
spec:
  group: platform.sparkleponyranch.com
  names:
    plural: ponydatabases
    singular: ponydatabase
    kind: PonyDatabase
    shortNames:
      - pdb
  scope: Namespaced
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                size:
                  type: string
                  enum:
                    - small
                    - medium
                    - large
```

Notes on this CRD:

* `metadata.name` must be `<plural>.<group>`, enabling API discovery.
* `names` controls how the resource appears to users and tools (`kind`, `plural`, `shortNames`).
* `scope: Namespaced` places objects inside namespaces — change to `Cluster` for cluster-scoped resources.
* `openAPIV3Schema` provides server-side validation for fields under `spec`, reducing misconfiguration.

### Example custom resource using that CRD

Once the CRD is installed, developers create resources like this to express intent:

```yaml theme={null}
apiVersion: platform.sparkleponyranch.com/v1
kind: PonyDatabase
metadata:
  name: user-profiles-db
  namespace: dev-team
spec:
  size: "medium"
  backupEnabled: true
  team: "magical-creatures"
  environment: "development"
```

The controller/operator that owns `PonyDatabase` reads this `spec` and provisions the underlying resources (StatefulSets, Services, PVCs, backups, Secrets) — developers only declare intent.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/0r3GTobZImleUlJh/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/from-complex-infrastructure-to-simple-apis.jpg?fit=max&auto=format&n=0r3GTobZImleUlJh&q=85&s=78b192b6f7f8b220898497800a8a4d1d" alt="A presentation slide titled &#x22;From Complex Infrastructure to Simple APIs&#x22; showing a four-level colored pyramid with labeled steps: Abstraction (1), Standardization (2), Empowerment (3), and Governance (4). The slide includes a small &#x22;© Copyright KodeKloud&#x22; note at the bottom left." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/from-complex-infrastructure-to-simple-apis.jpg" />
</Frame>

## Validation, documentation, and guardrails

CRDs provide built-in validation and generate machine-readable API documentation (OpenAPI v3). Use schemas to:

* Enforce required fields and allowed values (enums).
* Apply numeric constraints (minimum/maximum).
* Prevent unsupported configurations and enforce governance.

Benefits:

* Early detection of invalid manifests.
* Better developer UX: `kubectl explain` and generated API docs.
* Clear upgrade and governance paths via controlled schema changes.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/TBTtba-GA4Mqs__t/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/built-in-validation-documentation-benefits.jpg?fit=max&auto=format&n=TBTtba-GA4Mqs__t&q=85&s=8a0ced480b145c92b5dc6b08e5e3d017" alt="A presentation slide titled &#x22;Built-In Validation and Documentation&#x22; showing five numbered, colored circles with corresponding boxes labeled as benefits. The listed benefits are Automatic validation, API documentation, kubectl describe, Error prevention, and Consistent resources." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/built-in-validation-documentation-benefits.jpg" />
</Frame>

## Designing CRDs collaboratively

CRD design sits at the intersection of product, infrastructure, and SRE. Collaborate early to choose fields, defaults, lifecycle semantics, and status reporting. Good collaboration reduces iteration and operational surprises.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/0r3GTobZImleUlJh/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/team-collaboration-crd-design.jpg?fit=max&auto=format&n=0r3GTobZImleUlJh&q=85&s=443abee4480088bffb9104b58e7603ad" alt="A slide titled &#x22;Team Collaboration on CRD Design&#x22; showing three team members — Swati (SRE), Alan (Infrastructure), and Phuong (Developer) — each with colored circular avatars. Swati handles monitoring/backup/reliability, Alan designs infrastructure templates, and Phuong provides feedback on developer experience." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/team-collaboration-crd-design.jpg" />
</Frame>

## Controllers and the reconciliation loop

A CRD defines shape and rules; controllers implement behavior. Controllers:

* Watch custom resources and related objects.
* Compare desired (`spec`) vs actual cluster state.
* Plan and execute changes (create/update/delete dependent resources).
* Update `status` with progress and health.

Reconciliation is continuous. Typical loop:

1. Watch (event or periodic sync)
2. Validate current vs desired state
3. Plan changes
4. Execute (create/update/delete)
5. Observe and update `status`
6. Repeat

This level-driven approach ensures the cluster converges to the declared state.

## Securing CRD access with RBAC

CRDs integrate with Kubernetes RBAC so teams can be allowed to create and manage high-level resources without giving access to low-level primitives.

Example Role allowing a team to manage PonyDatabase objects and view Pods:

```yaml theme={null}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: pony-database-user
  namespace: dev-team
rules:
  - apiGroups:
      - platform.sparkleponyranch.com
    resources:
      - ponydatabases
    verbs:
      - get
      - list
      - create
      - update
  - apiGroups:
      - ""
    resources:
      - pods
    verbs:
      - get
      - list
```

This enforces least privilege: teams can request databases but cannot directly change underlying Pods or cluster-level resources.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/0r3GTobZImleUlJh/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/securing-crd-access-rbac-strategy.jpg?fit=max&auto=format&n=0r3GTobZImleUlJh&q=85&s=53d0a3f1b40855b6d6b10814a00d7fde" alt="A presentation slide titled &#x22;Securing CRD Access With RBAC&#x22; outlining a &#x22;Security Strategy.&#x22; It lists four key points: granular permissions, separation of concerns, least privilege principle, and team-based access control." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/securing-crd-access-rbac-strategy.jpg" />
</Frame>

<Callout icon="warning" color="#FF6B6B">
  When granting permissions, prefer roles scoped to a namespace and use the least-privilege principle. Avoid giving broad cluster-level permissions unless strictly required.
</Callout>

## Evolving CRD schemas and API versions

CRDs support versioning and conversion. Best practices when evolving schemas:

* Make additive, backward-compatible changes where possible.
* Avoid removing fields; mark fields deprecated and provide migration paths.
* Use `conversion` webhooks or structural schemas for multi-version support.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/0r3GTobZImleUlJh/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/managing-crd-schema-changes-pillars.jpg?fit=max&auto=format&n=0r3GTobZImleUlJh&q=85&s=7a74bfe8a7025113d3fca46eb609ddd0" alt="Slide titled &#x22;Managing CRD Schema Changes&#x22; showing four pillars: Multiple Versions, Conversion, Migration, and Backward Compatibility, each with an icon and brief description. The slide is branded © KodeKloud." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/managing-crd-schema-changes-pillars.jpg" />
</Frame>

## Developer experience features

CRDs offer UX features that make life easier for teams:

* Subresources (`status`, `scale`) enable safe status updates and HPA integration.
* Additional printer columns and custom printers improve `kubectl get` output.
* Controllers can expose Prometheus metrics for reconcilers, queue depth, and durations.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/TBTtba-GA4Mqs__t/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/2025-crd-capabilities-subresources-custom-printers.jpg?fit=max&auto=format&n=TBTtba-GA4Mqs__t&q=85&s=d58be2f640f78c9e8ad1629286ef8644" alt="Slide titled &#x22;2025 CRD Capabilities&#x22; with two feature panels: &#x22;Subresources&#x22; listing status and scale subresources, separate status updates, horizontal scaling, and specialized endpoints, and &#x22;Custom Printers&#x22; mentioning kubectl output customization and formatted table output. The slide is branded © Copyright KodeKloud." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/2025-crd-capabilities-subresources-custom-printers.jpg" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/TBTtba-GA4Mqs__t/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/2025-crd-capabilities-printer-columns-metrics.jpg?fit=max&auto=format&n=TBTtba-GA4Mqs__t&q=85&s=1ff1da0c2108caa9399cb377ac4c965d" alt="A presentation slide titled &#x22;2025 CRD Capabilities&#x22; showing two feature boxes labeled &#x22;Additional Printer Columns&#x22; and &#x22;Metrics.&#x22; The left box lists enhanced kubectl output items (status summaries, resource metrics, custom data fields) and the right box lists Prometheus metrics integration items (controller performance, resource statistics, operational insights)." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/2025-crd-capabilities-printer-columns-metrics.jpg" />
</Frame>

## Choosing the right extension

Decide between simple config, schema-only extension, or schema+automation:

| Extension Type | Use Case | Complexity | Validation |
| - | -: | -: | - |
| ConfigMaps | Simple key/value configuration | Low | None (client-side only) |
| CRDs | Domain-specific API with schema validation | Medium | OpenAPI v3 server-side validation |
| Operators | CRD plus controller/operator with orchestration logic | High | Schema + automation and lifecycle logic |

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/0r3GTobZImleUlJh/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/kubernetes-extensions-comparison-configmaps-crds-operators.jpg?fit=max&auto=format&n=0r3GTobZImleUlJh&q=85&s=2f08f7b8c6269538743198e7def4281d" alt="A slide titled &#x22;Choosing the Right Kubernetes Extension&#x22; showing a table that compares three extension types—ConfigMaps, CRDs, and Operators—by use case, complexity, and validation. It lists ConfigMaps as low-complexity for simple config, CRDs as medium with schema-based validation, and Operators as high-complexity with schema + logic." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/kubernetes-extensions-comparison-configmaps-crds-operators.jpg" />
</Frame>

Operators are CRDs with controllers that encode operational knowledge, automated workflows, and domain logic. Choose an Operator when you need both schema and complex orchestration.

## CRD design best practices

* Design for developers: clear names, predictable defaults, and good docs.
* Prefer additive changes; mark fields deprecated before removal.
* Expose rich `status` for Day-2 operations (progress, conditions).
* Instrument controllers (metrics, events, logs).
* Validate and sanitize inputs; enforce policies via admission controllers or OPA/Gatekeeper.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/TBTtba-GA4Mqs__t/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/crd-design-best-practices-pillars.jpg?fit=max&auto=format&n=TBTtba-GA4Mqs__t&q=85&s=53285b56f4d3547d476ca2ec11c3884a" alt="A slide titled &#x22;CRD Design Best Practices&#x22; showing five pillars—User-Centric, Immutable Specs, Rich Status, Observability, and Security—each with a short guideline. Each pillar is illustrated with a colored circular icon and recommendations like &#x22;Design for developer experience&#x22; and &#x22;Validate all inputs, enforce policies.&#x22;" width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/crd-design-best-practices-pillars.jpg" />
</Frame>

## Common CRD patterns

Typical platform CRDs:

* DatabaseClaims — request a managed database.
* Environment — provision a dev/test/stage environment.
* Application — deploy an app with opinionated defaults.
* Certificate — request TLS certificates.

These intent-based CRDs map developer requests to platform-managed resources; add controllers when orchestration is required.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/0r3GTobZImleUlJh/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/platform-engineering-crd-patterns.jpg?fit=max&auto=format&n=0r3GTobZImleUlJh&q=85&s=8b5fd2f5adbae7c3968ac7c3e5ff1074" alt="A slide titled &#x22;Platform Engineering CRD Patterns&#x22; showing four colored boxes labeled DatabaseClaim, Environment, Application, and Certificate. Each box has a short description of its purpose (request managed databases, provision complete environments, deploy applications, request TLS certificates)." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/platform-engineering-crd-patterns.jpg" />
</Frame>

## Tools and local validation

Tools to accelerate CRD and controller development:

* controller-gen — generate CRD YAML & boilerplate from Go types: [https://github.com/kubernetes-sigs/controller-tools/tree/master/cmd/controller-gen](https://github.com/kubernetes-sigs/controller-tools/tree/master/cmd/controller-gen)
* Kubebuilder — scaffold CRDs and controllers: [https://book.kubebuilder.io/](https://book.kubebuilder.io/)
* Operator SDK — higher-level operator framework: [https://sdk.operatorframework.io/](https://sdk.operatorframework.io/)

Validate locally before applying:

```bash theme={null}
kubectl apply --dry-run=client -f my-crd.yaml
```

After installing a CRD, use `kubectl explain` to inspect fields and schema.

## Observability and metrics

Monitor controllers and CRDs:

* Controller metrics: reconciliation success/failure, durations, queue depth.
* Resource metrics: creation/deletion counts, resource sizes.
* Alerts: controller errors and excessive reconciliation delays.
* Correlate controller metrics with application and cluster-level observability (e.g. Prometheus).

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/TBTtba-GA4Mqs__t/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/crd-metrics-monitoring-observability-strategy.jpg?fit=max&auto=format&n=TBTtba-GA4Mqs__t&q=85&s=d8b58aaf89abab4057ad3801def0e1d8" alt="A slide titled &#x22;CRD Metrics and Monitoring&#x22; showing an &#x22;Observability Strategy&#x22; with four boxes: Controller Metrics, Resource Metrics, Performance, and Alerting. Each box lists examples like reconciliation success/failure rates, custom resource creation/deletion counts, reconciliation duration and queue depth, and alerts on controller failures or delays." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/crd-metrics-monitoring-observability-strategy.jpg" />
</Frame>

## Real-world examples

Many CNCF projects use CRDs and operators in production:

* cert-manager — Certificate CRDs and lifecycle automation: [https://cert-manager.io/](https://cert-manager.io/)
* Zalando Postgres Operator — Postgres clusters: [https://github.com/zalando/postgres-operator](https://github.com/zalando/postgres-operator)
* Prometheus Operator — ServiceMonitor, PrometheusRule: [https://github.com/prometheus-operator/prometheus-operator](https://github.com/prometheus-operator/prometheus-operator)
* Istio — VirtualService, DestinationRule: [https://istio.io/](https://istio.io/)

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/TBTtba-GA4Mqs__t/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/cncf-crds-certmanager-postgres-istio-prometheus.jpg?fit=max&auto=format&n=TBTtba-GA4Mqs__t&q=85&s=260cca7abdf514d3dccc74d12eac7336" alt="A slide titled &#x22;CRDs in the CNCF Ecosystem&#x22; showing four colored cards for cert-manager, Zalando PostgreSQL Operator, Istio, and Prometheus Operator. Each card lists example CRDs (Certificate, PostgreSQL, VirtualService/DestinationRule, ServiceMonitor/PrometheusRule) with a short description of their purpose." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/cncf-crds-certmanager-postgres-istio-prometheus.jpg" />
</Frame>

## Key takeaways

* CRDs extend Kubernetes APIs to provide platform-specific, intent-based resources for self-service.
* Controllers/operators reconcile custom resources into real cluster objects (StatefulSets, Services, PVCs, Secrets).
* Use OpenAPI v3 schemas for server-side validation and documentation.
* Integrate CRDs with RBAC, versioning, conversion, and observability.
* Favor additive, backward-compatible changes and design APIs for a great developer experience.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/0r3GTobZImleUlJh/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/custom-resources-key-takeaways.jpg?fit=max&auto=format&n=0r3GTobZImleUlJh&q=85&s=da2a013a9d90454e5584b8e4a5ce6de1" alt="A presentation slide titled &#x22;Key Takeaways – Custom Resources&#x22; showing three colored boxes labeled 01 API Extension, 02 Self-Service, and 03 Controllers with brief descriptions of each (CRDs extend Kubernetes; developers use simple APIs; controllers watch and reconcile resources). The slide has a clean white background and a small copyright notice for KodeKloud." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/custom-resources-key-takeaways.jpg" />
</Frame>

## Additional reminders

* Use CRDs when you need a schema-backed, domain-specific API.
* Use Operators when you also need complex automation and orchestration logic.
* Keep developer-facing APIs simple and push complexity into platform controllers.
* Instrument controllers and CRDs for metrics, logs, events, and alerts.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/0r3GTobZImleUlJh/images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/custom-resources-takeaways-rbac-versioning-ecosystem.jpg?fit=max&auto=format&n=0r3GTobZImleUlJh&q=85&s=292f8cfe565f6337025947bbb4e86109" alt="A presentation slide titled &#x22;Key Takeaways – Custom Resources&#x22; showing four colored panels numbered 05–08 that list: RBAC Integration, Versioning, Best Practices, and Ecosystem with brief explanatory notes." width="1920" height="1080" data-path="images/Prep-Course-Certified-Cloud-Native-Platform-Engineering-Associate-CNPA/Domain-4-Platform-APIs-and-Provisioning-Infrastructure/Custom-Resources-CRDs-for-Self-Service-APIs/custom-resources-takeaways-rbac-versioning-ecosystem.jpg" />
</Frame>

References and further reading:

* Kubernetes CRD docs: [https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/)
* Kubebuilder book: [https://book.kubebuilder.io/](https://book.kubebuilder.io/)
* controller-tools / controller-gen: [https://github.com/kubernetes-sigs/controller-tools](https://github.com/kubernetes-sigs/controller-tools)
* Operator SDK: [https://sdk.operatorframework.io/](https://sdk.operatorframework.io/)
* Prometheus: [https://prometheus.io/](https://prometheus.io/)
* cert-manager: [https://cert-manager.io/](https://cert-manager.io/)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/certified-cloud-native-platform-engineering-associate-cnpa/module/7b8d1069-510d-48c6-b656-7573a193aeff/lesson/95448e95-954a-4ab8-845b-f8c778959641" />
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.