skip to content
Alvin Lucillo

Resource mapping CRD error

/ 1 min read

💻 Tech

If you encounter this error when creating an object based on a CRD, this might because served is false. The value must be true to indicate that it’s available for use.

error:

k apply -f custom.yaml
error: resource mapping not found for name: "internal-space" namespace: "default" from "custom.yaml": no matches for kind "Internal" in version "datasets.kodekloud.com/v1"
ensure CRDs are installed first

custom.yaml

kind: Internal
apiVersion: datasets.kodekloud.com/v1
metadata:
  name: internal-space
  namespace: default
spec:
  internalLoad: "high"
  range: 80
  percentage: "50"

crd.yaml

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: internals.datasets.kodekloud.com
  namespace: default
spec:
  group: datasets.kodekloud.com
  versions:
    - name: v1
      served: false # <-- should be true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                internalLoad:
                  type: string
                range:
                  type: integer
                percentage:
                  type: string
  scope: Namespaced
  names:
    plural: internals
    singular: internal
    kind: Internal