<p>I have 2 nfs mounts of 100TB each i.e. 200TB in total. I have mounted these 2 on Kubernetes container. My file server is a typical log server that holds a mix of data types like JSON, HTML, images, logs and text files, etc. The size of files also varies a lot. I am kind of guessing what should be the ideal resource request for this kubernetes container? My assumption,</p>
<ol>
<li>As this is file reads its i/o intensive operation, CPU should be high</li>
<li>Since we may have a large file size transferred over, Memory should also be high.</li>
</ol>
<p>Just wanted to check if my assumptions are right?</p>

Hacker
<p>Posting this community wiki answer to set a baseline and to show one possible set of actions that should led to solution.</p>
<p>Feel free to edit and expand.</p>
<hr />
<p><strong>As I stated previously, this setup will heavily depend on case to case basis and giving the approximate could be misleading</strong>. In my opinion the best course of actions to take would be:</p>
<ul>
<li>Install monitoring tools</li>
<li>Deploy the application for testing</li>
<li>Simulate the load</li>
</ul>
<hr />
<h3>Install monitoring tools</h3>
<p>There are a lot of monitoring tools that can retrieve the data about the <code>CPU</code> and <code>Memory</code> usage of your <code>Pods</code>. You will need to choose the one that suits your workloads and infrastructure best.</p>
<p>Some of them are:</p>
<ul>
<li><em><a href="https://prometheus.io/" rel="nofollow noreferrer">Prometheus.io</a></em></li>
<li><em><a href="https://www.elastic.co/elastic-cloud-kubernetes" rel="nofollow noreferrer">Elastic.co</a></em></li>
<li><em><a href="https://www.datadoghq.com/" rel="nofollow noreferrer">Datadoghq.com</a></em></li>
</ul>
<hr />
<h3>Deploy the application for testing</h3>
<p>This can also be a quite wide topic considering the fact that the exact requirements and the infrastructure is not known. One of many questions is if the <code>Deployment</code> should have a steady <code>replica</code> amount or should use some kind of <code>Horizontal Pod Autoscaling</code> (basing on <code>CPU</code> and/or <code>Memory</code>). The <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes" rel="nofollow noreferrer">access modes</a> on the storage shouldn't matter as <code>NFS</code> supports <code>RWX</code>.</p>
<p>The basic implementation of the <code>Deployment</code> that could be used can be found in the official Kubernetes documentation:</p>
<ul>
<li><em><a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#creating-a-deployment" rel="nofollow noreferrer">Kubernetes.io: Docs: Concepts: Workloads: Controllers: Deployment: Creating a deployment</a></em></li>
<li><em><a href="https://kubernetes.io/docs/concepts/storage/volumes/#nfs" rel="nofollow noreferrer">Kubernetes.io: Docs: Concepts: Storage: Volumes: NFS</a></em></li>
</ul>
<hr />
<h3>Simulate the load</h3>
<p>The simulation part could go either as a real life usage or by using a tool to simulate the load. You would need in this part to choose the option/tool that suits your requirements the most. This part will show you the approximate resources that should be allocated to your <code>nginx file explorer</code>.</p>
<blockquote>
<p>A side note!</p>
<p>In my testing I've used <code>ab</code> to check if the load was divided equally by <code>X</code> amount of replicas.</p>
</blockquote>
<hr />
<h3>Additional resources</h3>
<p>I do recommend to check the official guide on official Kubernetes documentation regarding managing resources:</p>
<ul>
<li><em><a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/" rel="nofollow noreferrer">Kubernetes.io: Docs: Concepts: Configuration: Manage resources containers</a></em></li>
</ul>
<p>I also think that the <code>VPA</code> could help you in the whole process as:</p>
<blockquote>
<p>Vertical Pod Autoscaler (VPA) frees the users from necessity of setting up-to-date resource limits and requests for the containers in their pods. When configured, it will set the requests automatically based on usage and thus allow proper scheduling onto nodes so that appropriate resource amount is available for each pod. It will also maintain ratios between limits and requests that were specified in initial containers configuration.</p>
<p>It can both down-scale pods that are over-requesting resources, and also up-scale pods that are under-requesting resources based on their usage over time.</p>
<p>-- <em><a href="https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler" rel="nofollow noreferrer">Github.com: Kubernetes: Autoscaler: Vertical Pod Autoscaler</a></em></p>
</blockquote>
<p>I'd reckon you could also look on this answer:</p>
<ul>
<li><em><a href="https://stackoverflow.com/a/63224542/12257134">Stackoverflow.com: Answers: PromQL query to find CPU and memory used for the last week</a></em></li>
</ul>
