这里记录ingress的参数配置文件,修改方式可以如下:
[root@wulaoer.org]# kubectl edit configmaps -n kube-system nginx-configuration ########################################## apiVersion: v1 data: allow-backend-server-header: "true" enable-underscores-in-headers: "true" generate-request-id: "true" ignore-invalid-headers: "true" log-format-upstream: $remote_addr - [$remote_addr] - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_length $request_time [$proxy_upstream_name] $upstream_addr $upstream_response_length $upstream_response_time $upstream_status $req_id $host [$proxy_alternative_upstream_name] max-worker-connections: "65536" proxy-body-size: 500m #上传文件大小限制 proxy-connect-timeout: "10" #后端服务器连接的超时时间 reuse-port: "true" server-tokens: "false" ssl-redirect: "false" upstream-keepalive-timeout: "900" use-gzip: "true" #gzip压缩 worker-cpu-affinity: auto kind: ConfigMap metadata: annotations: ##################################################
修改之后不需要重启,即可生效。这里的配置配置ingress一样的。比如如果服务需要其他的请求方式,就需要修改
kubectl edit ingress -n 命名空间 ingress名称 ############################################### apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: ####################################### kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/cors-allow-credentials: "true" nginx.ingress.kubernetes.io/cors-allow-headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,app_key,storeToken,Referer nginx.ingress.kubernetes.io/cors-allow-methods: PUT,GET,POST,OPTIONS nginx.ingress.kubernetes.io/cors-allow-origin: '*' nginx.ingress.kubernetes.io/enable-cors: "true" ########################################################
两者的区别一个是针对所有服务的,一个是针对单个服务。
您可以选择一种方式赞助本站
支付宝扫一扫赞助
微信钱包扫描赞助
赏