oc kustomize error - "couldn't make loader... must be a directory to be root"

Solution In Progress - Updated -


  • When running code with oc kustomize . receive the following error - it seems to be using a yaml file as a directory, however, this works in kustomize build . :
Error: couldn't make loader for gitlab-ci-sa.yaml: got file 'gitlab-ci-sa.yaml', but 'overlays/dev/gitlab-ci-sa.yaml' must be a directory to be a root
  • If running the command with kustomize build overlays/dev there is no issues with the current version :
{Version:kustomize/v4.1.3 GitCommit:0f614e92f72f1b938a9171b964d90b197ca8fb68 BuildDate:2021-05-21T17:30:04+01:00 GoOs:darwin GoArch:amd64}
  • Since kustomize is actually bundled in kubectl and oc simply acts as a wrapper around kubectl, this is a limitation from the kubernetes level.


  • Red Hat OpenShift Container Platform
    • 4.7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content