<p>What order does kubectl execute if I just run <code>kubectl -f test/</code> which has all the files and folders below? Would it determine that <code>mysite-db-namespace.yml</code> to run first and then <code>other services.yml</code> etc?</p>
<p>Or should I be naming the files with numbers so it it executes exactly how I want?</p>
<pre><code>test/
├── database
│   ├── database-clusterip-service.yml
│   ├── database-deployment.yml
│   ├── persistent-Volume-Claim.yml
│   ├── storage-class.yml
│   └── mysite-db-namespace.yml
├── httpd
│   ├── httpd-clusterip-service.yml
│   ├── httpd-deployment.yml
│   ├── ingress-rules.yml.orig
│   ├── nginx-ingress-controller.yml.orig
│   └── nginx-ingress-lb-service.yml.orig
└── tomcat
    ├── tomcat-clusterip-service.yml
    ├── tomcat-deployment.yml
    └── mysite-web-namespace.yml
</code></pre>

user630702
<p>You can use <a href="https://helm.sh/docs/topics/charts_hooks/" rel="nofollow noreferrer">helm hooks</a> to order your yamls. Other than that kubectl will load your yamls in same folder based on alphabetic order. This is not guarenteed to always work though, there can be race-condition issues where you apply the yaml first but it being in effect relies on the kubernetes side.</p>
