通常情況下尤辱,service和pod的IP可以被集群網(wǎng)絡(luò)訪問(wèn)惧所。外部訪問(wèn)的所有流量被丟棄或轉(zhuǎn)發(fā)到別處趟据。ingress是允許入站連接到達(dá)群集服務(wù)的規(guī)則集合.可以為外部提供可訪問(wèn)服務(wù)的URL盾戴,流量負(fù)載均衡雏掠,可被終止的ssl連接斩祭,以及基于配置的虛擬主機(jī)。
k8s ingress配置官網(wǎng)鏈接:https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/annotations.md
在sonar-scanner分析go項(xiàng)目時(shí)磁玉,結(jié)果文件超過(guò)1M(nginx ingress controller 默認(rèn)定義的上傳大型7蕖)驾讲,無(wú)法上傳到sonarqube上蚊伞,因此需要更改nginx配置中client_max_body_size的大小,具體修改ingress文件吮铭,如下
- 針對(duì)單個(gè)ingress
[root@master24 021-sonarqube]# cat sonarqube-ing.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: sonarqube
namespace: default
annotations:
ingress.kubernetes.io/proxy-body-size: "600M"
spec:
rules:
- host: tests.sonar.com
http:
paths:
- backend:
serviceName: sonarqube
servicePort: 9000
path: /
- 針對(duì)所有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: "50m"