<p>I need deploy daemonset in Kubernetes, but each pod in different nodes requires different memory and cpu requests for different hardware types.</p>

che yang
<p><em>Since you have asked such an imprecise question, you're going to get an imprecise answer -- update your question with more specifics and you'll get a better answer</em></p>

<p>Using helm can help you with that problem, since the manifests are subject to golang template evaluation; thus:</p>

<pre><code># values.yaml
instance_type: m5.large
---
# templates/deployment.yaml
  {{ $mem := "2Gi" }}
  {{ if (hasSuffix .Values.instance_type ".xlarge") }}
  {{   $mem = "4Gi"
  {{ end }}
  spec:
    template:
      spec:
        containers:
        - resources:
             requests:
               memory: {{ $mem }}
</code></pre>

<p>then install it and the user can choose the size Node they have:</p>

<pre><code>$ helm install --set instance_type=r5.xlarge my-release my/chart
</code></pre>

<hr>

<p>If, instead, you mean that you have a mixed set if instances and you want your <strong>one</strong> Deployment to adjust its memory settings according to the headroom available on its target Node, then you'll want a <a href="https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#mutatingadmissionwebhook" rel="nofollow noreferrer">Mutating Admission Webhook</a> which can use whatever business rules you want to adjust the <code>resource:</code> field of the soon-to-be-scheduled Pod to set its resources as you see fit. You can use the <a href="https://github.com/kubernetes/autoscaler/tree/cluster-autoscaler-1.17.1/vertical-pod-autoscaler#vertical-pod-autoscaler" rel="nofollow noreferrer">vertical pod autoscaler</a> as a source of inspiration, since they're doing roughly the same thing just over a different timescale</p>
