1

I've registered custom resource definition in K8S:

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: resources.example.com
  labels:
    service: "my-resource"
spec:
  group: example.com
  version: v1alpha1
  scope: Namespaced
  names:
    plural: resources
    singular: resource
    kind: MYRESOURCE
    shortNames:
    - res

Now on attempt to get an 'explain' for my custom resource with:

kubectl explain resource

I get the following error:

group example.com has not been registered

How can I add an explain information to my custom resource definition, or is this not supported for CRDs?

kofucii
  • 7,393
  • 12
  • 51
  • 79

1 Answers1

2

explain works using openapi schema information published by the server. Prior to v1.15, CRDs did not have the ability to publish that info.

In 1.15+, CRDs that specify structural schemas and enable pruning publish OpenAPI and work with explain.

Jordan Liggitt
  • 16,933
  • 2
  • 56
  • 44
  • Is this still valid with k8s 1.14 / 1.15? – Jason Leach Oct 09 '19 at 17:46
  • 1
    in 1.15+ CRDs that specify [structural schemas](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#specifying-a-structural-schema) and [enable pruning](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#pruning-versus-preserving-unknown-fields) can publish OpenAPI and work with explain – Jordan Liggitt Oct 10 '19 at 13:42