0

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>
Tiago P. O.
  • 97
  • 1
  • 7
  • Hello, could you tell how exactly have you installed your `nginx-ingress`? Also there is a documentation about `Ingress` in general on IBM Cloud: https://cloud.ibm.com/docs/containers?topic=containers-ingress-about . – Dawid Kruk Feb 16 '21 at 11:23
  • Hello @dawid It was a long time ago, but I don't remember having to install anything. I just created the my-ingress.yaml file (the first code in my post) without the proxy-body-size annotation and ran kubectl apply. I followed this article [link](https://www.ibm.com/cloud/blog/how-to-use-the-ingress-application-load-balancer-to-expose-an-app-outside-a-kubernetes-cluster) Apparently, the IBM Kubernetes has some external ingress running in the kube-system namespace using nginx. And I should change this configuration, but I don't know how to make the annotation change to be applied. – Tiago P. O. Feb 18 '21 at 12:38

0 Answers0