CRD Scope
Custom Resource Definitions (CRDs) contain a scope field that determines whether the resulting Custom Resource (CR) is cluster or namespace scoped. An operator author might use a namespaced-scoped CRD to restrict access to a CR to certain namespaces, or to have different versions of CRs accessible in different namespaces. Alternatively, an operator author might want a cluster-scoped CRD so all namespaces have visibility and access to CRs.
When creating a new API, the --namespaced
flag controls whether the resulting CRD will be cluster or namespace scoped. By default, --namespaced
is set to which sets the scope to Namespaced
. An example command to create a cluster-scoped API would be:
To set the scope to namespaced, the marker would be set to instead.