Kubectl Apply – All Files in Directory

kubectl apply command is used to manage applications by creating and updating Kubernetes resources declared in configuration files.

In addition to possibly to manage resources through individual files, there is a way to apply all the YAML files in a folder.

In this short note i will show how to use the kubectl apply command to apply all files in a directory.

Cool Tip: Create a Deployment in K8s using the kubectl command! Read more →

Kubectl Apply Directory

Apply all files in a directory:

$ kubectl apply -f <directory>

Recursively apply all files in subdirectories too:

$ kubectl apply -f <directory> --recursive