<p>I have followed the steps mentioned in this <a href="https://kubernetes.github.io/ingress-nginx/deploy/" rel="nofollow noreferrer">nginx for kubernetes</a>, For installing this in <code>azure</code> i ran the following </p>

<pre><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/cloud/deploy.yaml
</code></pre>

<p>I opened that file and under the section <code># Source: ingress-nginx/templates/controller-deployment.yaml</code> i could see the <code>resources</code>, is there a way to override this and set the <code>cpu</code> and <code>memory</code> limit for that <code>ingress</code> and also i would like to know whether everything in there is customisable.</p>

doc_noob
<blockquote>
  <p>I would like to know whether everything in there is customizable.</p>
</blockquote>

<p>Almost everything is customizable, but keep in mind that you must know exactly what are you changing, otherwise it can break your ingress.</p>

<blockquote>
  <p>Is there a way to override this and set the cpu and memory limit for that ingress?</p>
</blockquote>

<p>Aside for download and editing the file before deploying it, Here are three ways you can customize it on the run:</p>

<ol>
<li><p><strong><a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#edit" rel="nofollow noreferrer">Kubectl Edit:</a></strong></p>

<ul>
<li>The edit command allows you to directly edit any API resource you can retrieve via the command line tools. </li>
<li>It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, or fall back to 'vi' for Linux or 'notepad' for Windows.</li>
<li>You can edit multiple objects, although changes are applied one at a time.
Example:</li>
</ul></li>
</ol>

<pre><code>kubectl edit deployment ingress-nginx-controller -n ingress-nginx
</code></pre>

<p>This is the command that will open the deployment mentioned in the file. If you make an invalid change, it will not apply and will save to a temporary file, so use it with that in mind, if it's not applying, you changed something you shouldn't like the structure.</p>

<ol start="2">
<li><strong><a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#patch" rel="nofollow noreferrer">Kubectl Patch</a> using a yaml file</strong>:

<ul>
<li>Update field(s) of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.</li>
<li>JSON and YAML formats are accepted.</li>
</ul></li>
</ol>

<p>Create a simple file called <code>patch-nginx.yaml</code> with the minimal following content (the parameter you wish to change and his structure):</p>

<pre><code>spec:
  template:
    spec:
      containers:
        - name: controller
          resources:
            requests:
              cpu: 111m
              memory: 99Mi
</code></pre>

<p>The command structure is: <code>kubectl patch &lt;KIND&gt; &lt;OBJECT_NAME&gt; -n &lt;NAMESPACE&gt; --patch "$(cat &lt;FILE_TO_PATCH&gt;)"</code> </p>

<p>Here is a full example:</p>

<pre><code>$ kubectl patch deployment ingress-nginx-controller -n ingress-nginx --patch "$(cat patch-nginx.yaml)" 
deployment.apps/ingress-nginx-controller patched

$ kubectl describe deployment ingress-nginx-controller -n ingress-nginx | grep cpu
      cpu:      111m
$ kubectl describe deployment ingress-nginx-controller -n ingress-nginx | grep memory
      memory:   99Mi
</code></pre>

<ol start="3">
<li><strong>Kubectl <a href="https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#alternate-forms-of-the-kubectl-patch-command" rel="nofollow noreferrer">Patch with JSON format</a></strong>:

<ul>
<li>This is the one-liner version and it follows the same structure as the yaml version, but we will pass the parameter in a json structure instead:</li>
</ul></li>
</ol>

<pre><code>$ kubectl patch deployment ingress-nginx-controller -n ingress-nginx --patch '{"spec":{"template":{"spec":{"containers":[{"name":"controller","resources":{"requests":{"cpu":"122m","memory":"88Mi"}}}]}}}}'
deployment.apps/ingress-nginx-controller patched

$ kubectl describe deployment ingress-nginx-controller -n ingress-nginx | grep cpu
      cpu:      122m
$ kubectl describe deployment ingress-nginx-controller -n ingress-nginx | grep memory
      memory:   88Mi
</code></pre>

<p>If you have any doubts, let me know in the comments.</p>
