Warm tip: This article is reproduced from stackoverflow.com, please click
etcd kubectl kubernetes kubernetes-custom-resources

Can I suspend typechecking on kubectl apply?

发布于 2020-04-18 10:03:56

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?

Questioner
Joshua Fox
Viewed
73
coderanger 2020-02-05 01:36

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.