Kubernetes CRDs: Custom Resource Definitions

What Are CRDs?

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
# name must match the spec fields below, and be in the form: <plural>.<group>
name: crontabs.stable.example.com
spec:
# group name to use for REST API: /apis/<group>/<version>
group: stable.example.com
# list of versions supported by this CustomResourceDefinition
versions:
- name: v1
# Each version can be enabled/disabled by Served flag.
served: true
# One and only one version must be marked as the storage version.
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
cronSpec:
type: string
image:
type: string
replicas:
type: integer
# either Namespaced or Cluster
scope: Namespaced
names:
# plural name to be used in the URL: /apis/<group>/<version>/<plural>
plural: crontabs
# singular name to be used as an alias on the CLI and for display
singular: crontab
# kind is normally the CamelCased singular type. Your resource manifests use this.
kind: CronTab
# shortNames allow shorter string to match your resource on the CLI
shortNames:
- ct
apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
name: my-crontab
spec:
cronSpec: "* * * * */5"
image: hello-world

Using CRDs Effectively

Conclusion

--

--

--

>> www.loft.sh << Build Your Internal Kubernetes Platform With Virtual Clusters, Namespace Self-Service & Secure Multi-Tenancy

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

ArgoCD with Kustomize and ksops

Build a payment system with Django 3.1 and Stripe from scratch. Part 3

Connect to Oracle ADW using Python and cx_Oracle

Why Developers Must Learn to Design?

Understanding Rails Polymorphic Asociation

Simple GUI Calculator using Tkinter in Python

Aspects for System Design — Series

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Loft Labs

Loft Labs

>> www.loft.sh << Build Your Internal Kubernetes Platform With Virtual Clusters, Namespace Self-Service & Secure Multi-Tenancy

More from Medium

5 Reasons Why Engineers Need Access to Kubernetes Clusters

Two software developers writing code

Why You Should Empower ConfigMaps in Your Kubernetes Deployments?

Creating your own Template in Monokle

Will That Kubernetes v1.22 Upgrade Break My Application?