one of the kubectl features is to apply configurations sequentially following filename lexical order. This is useful for instance to create a namespace before applying the rest of the configuration. kustomize build breaks this feature as it generates a single specification.
One possible solution is to allow kustomize build -o directory/ && kubectl apply -f directory/. It's not as nice as piping the configuration but at least that would solve the problem stated above.
kustomize build output has a predefined order to handle this concern. The output will follow this order
"Namespace",
"CustomResourceDefinition",
"ServiceAccount",
"Role",
"ClusterRole",
"RoleBinding",
"ClusterRoleBinding",
"ConfigMap",
"Secret",
"Service",
"Deployment",
"StatefulSet",
"CronJob",
"PodDisruptionBudget",
If it doesn't satisfy your usage, let us know which order is missing.
is this implemented in v1.0.8? That should work except for CRD instances (not mentioned in your list), as it takes some time for the CRDs to be online.
All other types, including CRD instances, are sorted according to their group, version, kind, name. In the output, they will be appended to the end of the resources in the predefined list.
This has been available since 1.0.7.
thanks for the explanation. It's working as expected after fixing a typo.
Most helpful comment
All other types, including CRD instances, are sorted according to their group, version, kind, name. In the output, they will be appended to the end of the resources in the predefined list.
This has been available since 1.0.7.