Kubernetes: Custom Resource Definitions

A custom resource definition also known as CRD allows us to create custom resources. It is a way of extending the Kubernetes API and create resources for our own purposes.it is one of the ways to create custom resources other than using Aggregated APIs. Custom Resources Definition is currently under apiextensions.k8s.io/v1beta1.It is limited to only the existing functionality of the API. We can either have a custom resources scoped under a Cluster or Namespaced. Below is an example of how to create a Custom Resource Definition and the custom resource .

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: networks.alphatribe.com
spec:
  group: alphatribe.com
  version: v1
  scope: Cluster
  names:
    plural: networks
    singular: network
    shortNames:
    - net
    kind: Network
apiVersion: networks.alphatribe.com/v1
kind: Network
metadata:
  name: dev
spec:
  subnet: "10.5.2.0/24"
  bandwidthMb: 100
  enableARP: true

Leave a Reply

Your email address will not be published. Required fields are marked *