<p>How can one control the maximum resources to ever be used (at a given moment) by everything running in a specific k8s namespace. (Max. memory, max. CPU)? </p>

Developer
<p>This can be accomplished via a ResourceQuota on the given namespace.</p>

<p>From the <a href="https://kubernetes.io/docs/concepts/policy/resource-quotas/" rel="nofollow noreferrer">docs</a>:</p>

<blockquote>
  <p>A resource quota, defined by a ResourceQuota object, provides constraints that limit aggregate resource consumption per namespace. It can limit the quantity of objects that can be created in a namespace by type, as well as the total amount of compute resources that may be consumed by resources in that project.</p>
</blockquote>

<p>A resource quota is defined like so (from the <a href="https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/" rel="nofollow noreferrer">k8s admin docs</a>):</p>

<pre><code>apiVersion: v1
kind: ResourceQuota
metadata:
  name: mem-cpu-demo
spec:
  hard:
    requests.cpu: "1"
    requests.memory: 1Gi
    limits.cpu: "2"
    limits.memory: 2Gi
</code></pre>

<p>Note: This information comes from the k8s v1.16 documentation</p>
