k8s ingress advanced configuration, dynamically modify the upload file size limit parameters client_max_body_size

Typically, service and pod cluster of IP network can be accessed. All external access traffic is discarded or forwarded elsewhere. ingress is to allow inbound connections to reach set of rules Cluster service may provide the URL to access external services, traffic load balancing, ssl connection can be terminated, and based virtual host configuration.

k8s ingress configuration official website link: https: //github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/annotations.md

When sonar-scanner project analysis go, the outcome document of more than 1M (nginx ingress controller defined by default upload size), can not be uploaded to the sonarqube, it is necessary to change the nginx configuration client_max_body_size size, specific changes ingress file, as follows

For a single ingress

[root@master24 021-sonarqube]# cat sonarqube-ing.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: sonarqube
  namespace: default
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: "5M"
spec:
  rules:
  - host: tests.sonar.com
    http:
      paths:
      - backend:
          serviceName: sonarqube
          servicePort: 9000
        path: /

Notice nginx.ingress.kubernetes.ioto ingress-nginxthe startup parameter settings:

--annotations-prefix=nginx.ingress.kubernetes.io

Here Insert Picture Description

For all ingress

[root@master24 002-nginx-ingress-controller]# cat nginx-ingress-cm.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-custom-configuration
  namespace: kube-system
  labels:
    k8s-app: nginx-ingress-controller
data:
  proxy-body-size: "5m"
Published 125 original articles · won praise 8 · views 20000 +

Guess you like

Origin blog.csdn.net/ll837448792/article/details/103878561