<p>In a deployment yaml, how we can verify that the resources we need for the running pods are guaranteed by the k8s?</p>
<p>Is there a way to figure that out?</p>

Tariq Ganem
<p>Specify your resource <a href="https://v1-22.docs.kubernetes.io/docs/concepts/configuration/manage-resources-containers/#requests-and-limits" rel="nofollow noreferrer">request</a> in the deployment YAML. The kube-scheduler will ensure the resources even before scheduling the pods.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend
spec:
  selector:
    matchLabels:
      app: guestbook
      tier: frontend
  replicas: 3
  template:
    metadata:
      labels:
        app: guestbook
        tier: frontend
    spec:
      containers:
      - name: php-redis
        image: gcr.io/google-samples/gb-frontend:v4
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
</code></pre>
<p><strong>How Pods with resource requests are scheduled?</strong> <a href="https://v1-22.docs.kubernetes.io/docs/concepts/configuration/manage-resources-containers/#how-pods-with-resource-requests-are-scheduled" rel="nofollow noreferrer">Ref</a></p>
<blockquote>
<p>When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum capacity for each of the resource types: the amount of CPU and memory it can provide for Pods. The scheduler ensures that, for each resource type, the sum of the resource requests of the scheduled Containers is less than the capacity of the node. Note that although actual memory or CPU resource usage on nodes is very low, the scheduler still refuses to place a Pod on a node if the capacity check fails. This protects against a resource shortage on a node when resource usage later increases, for example, during a daily peak in request rate.</p>
</blockquote>
<p><strong>N.B.:</strong> However, if you want a container not to use more than its allowed resources, specify the <code>limit</code> too.</p>
