Add 'explain' information for custom resource definition in K8S

12/19/2017

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
kubernetes
kubernetes-custom-resources

1 Answer

12/19/2017

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
Source: StackOverflow