Search code examples
kuberneteskubectletcdkubernetes-custom-resources

Can I suspend typechecking on kubectl apply?


I am installing Custom Resources through an Operator. However, kubectl apply is blocked on
"Error from server (NotFound): customresourcedefinitions.apiextensions.k8s.io "my-crd.example.com" not found."

If there were a switch on kubectl apply along the lines of --no-typechecking, it would solve this. I would not cause a problem with a missing CRD, because the apply just sends the Kubernetes objects to etcd. Then, by the time that the Operator actually constructs the Custom Resource, the Custom Resource Definition would be available. (I have other code that guarantees that.)

So, can I suspend the typechecking that produces this error?


Solution

  • No, you can’t use a CRD API without actually creating the CRD. It’s not a type check, it’s how the system works through and through.