Just wondering, let’s say I have X Kubernetes deployment.yaml
, pod.yaml
, persistedvolumecliam.yaml
and service.yaml
files inside a directory.
The tutorials would tell us to do the following:
kubectl apply -f frontend-service.yaml,redis-master-service.yaml,redis-slave-service.yaml,frontend-deployment.yaml,redis-master-deployment.yaml,redis-slave-deployment.yaml
Is there a way just to do something like:
kubectl apply all
or
kubectl apply -f *
or some variation thereof to spin all of the kube stuffs within on directory?
3
Answers
You can apply everything inside a directory with
kubectl apply -f /path/to/dir
. To include subdirectories use the paramter-R
, likekubectl apply -R -f /path/to/dir
For more details check the reference documentation.
You can apply a YAML file using kubectl apply recursively in all folders by using the –recursive flag.
Here is the basic syntax once you are in the root folder: