I want to change nginx client_max_body_size using Kubernetes ingress annotations.
My ingress yaml file is like this:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: my-custom-server-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/proxy-body-size: "10m"
spec:
...
I only added the line nginx.ingress.kubernetes.io/proxy-body-size: "10m"
. As saing in here 413 error with Kubernetes and Nginx ingress controller
Then, I tried to apply using:
kubectl diff -f my-custom-ingress.yaml
kubectl apply -f my-custom-ingress.yaml
The problem is that this change is not being applied. Checking the nginx.conf file it is still the old 2M value.
user@user:~/git/my-custom-server$ kubectl exec -it -n kube-system pod/public-<xxx>-alb1-<yyy> -- cat /etc/nginx/nginx.conf | grep client_max
Defaulting container name to nginx-ingress.
client_max_body_size 2M;
I get the pod name using kubectl get pods -n kube-system | grep alb
as stated here https://cloud.ibm.com/docs/containers?topic=containers-ingress_health
$ kubectl get pods -n kube-system | grep alb
public-<xxx>-alb1-<yyy> 4/4 Running 0 136d
I'm very new to Kubernetes and apparently, IBM's one is a little different. I don't know why it does not create an ingress pod in my namespace. I'm 99% sure that this is the right one because it has no other. I don't know if I should restart differently and the 136d
goes back to 0d
when done correctly.
Any help is appreciated, thank you.
Edit - more info
I found that there is an ingress named alb-default-server
$ kubectl get ingress --all-namespaces
NAMESPACE NAME
default my-custom-server-ingress
kube-system alb-default-server
After editing and adding an annotation ingress.bluemix.net/client-max-body-size: size=10m
, nothing changed again. Ref: https://www.ibm.com/support/knowledgecenter/en/bluemix_stage/containers/cs_annotations.html
$ kubectl edit ingress alb-default-server -n kube-system
annotations:
ingress.bluemix.net/client-max-body-size: size=<size>