I have followed the steps mentioned in this nginx for kubernetes, For installing this in azure i ran the following
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/cloud/deploy.yamlI opened that file and under the section # Source: ingress-nginx/templates/controller-deployment.yaml i could see the resources, is there a way to override this and set the cpu and memory limit for that ingress and also i would like to know whether everything in there is customisable.
what the comment suggests ( download the file and manually override it or use helm chart ) or use kubectl edit deployment xxx and set those limits\requests.
I would like to know whether everything in there is customizable.
Almost everything is customizable, but keep in mind that you must know exactly what are you changing, otherwise it can break your ingress.
Is there a way to override this and set the cpu and memory limit for that ingress?
Aside for download and editing the file before deploying it, Here are three ways you can customize it on the run:
kubectl edit deployment ingress-nginx-controller -n ingress-nginxThis 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.
Create a simple file called patch-nginx.yaml with the minimal following content (the parameter you wish to change and his structure):
spec:
template:
spec:
containers:
- name: controller
resources:
requests:
cpu: 111m
memory: 99MiThe command structure is: kubectl patch <KIND> <OBJECT_NAME> -n <NAMESPACE> --patch "$(cat <FILE_TO_PATCH>)"
Here is a full example:
$ 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$ 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: 88MiIf you have any doubts, let me know in the comments.