【发布时间】:2021-11-04 22:11:37
【问题描述】:
我使用 helm-chart ingress-nginx (4.0.x) 创建入口控制器并使用它通过节点端口将 tcp 流量引导到我的部署(效果很好)。但我看到入口控制器不断打开和关闭与我部署的 pod 的 tcp 连接。 有谁知道为什么会发生这种情况或我该如何配置它?
我当前对 ingress-nginx 图表的配置是
ingress-nginx:
controller:
replicaCount: 2
nodeSelector:
beta.kubernetes.io/os: linux
admissionWebhooks:
patch:
nodeSelector:
beta.kubernetes.io/os: linux
service:
annotations:
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
defaultBackend:
nodeSelector:
beta.kubernetes.io/os: linux
tcp:
6203: storage-he10/lb-plc-in-scale-service:6203
2021-09-08 06:19:07.3733333 Tcp-Connection closed (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.0.47:48494)
2021-09-08 06:19:07.3766667 Tcp-Connection accepted (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.0.47:48576)
2021-09-08 06:19:09.0666667 Tcp-Connection closed (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.0.47:48518)
2021-09-08 06:19:09.0700000 Tcp-Connection accepted (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.1.83:58122)
2021-09-08 06:19:13.3900000 Tcp-Connection closed (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.0.47:48576)
2021-09-08 06:19:13.3933333 Tcp-Connection accepted (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.1.83:58156)
2021-09-08 06:19:15.0700000 Tcp-Connection closed (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.1.83:58122)
2021-09-08 06:19:15.0700000 Tcp-Connection accepted (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.1.83:58184)
2021-09-08 06:19:19.3933333 Tcp-Connection closed (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.1.83:58156)
2021-09-08 06:19:19.3966667 Tcp-Connection accepted (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.0.47:48768)
helm template 为我的部署生成以下代码
---
apiVersion: v1
kind: Service
metadata:
name: lb-plc-in-scale-service
namespace: storage-he10
labels:
siteName: he10
spec:
type: NodePort
selector:
app: plc-in-scale-service
ports:
# By default and for convenience, the `targetPort` is set to the same value as the `port` field.
- port: 6203
...
---
# Source: he10/templates/servers.yaml
kind: Deployment
apiVersion: apps/v1
metadata:
name: plc-in-scale-service
namespace: storage-he10
labels:
siteName: he10
spec:
replicas:
selector:
matchLabels:
app: plc-in-scale-service
template:
metadata:
labels:
app: plc-in-scale-service
annotations:
checksum/config: 4b3245c98480d806bcefeeea2890918ee4d272b2982c1f6fe0621fd323348231
spec:
hostAliases:
...
containers:
- name: plc-in-scale-service
image: ...
ports:
- containerPort: 6203
envFrom:
- configMapRef:
name: env-config-map-plc-in-scale-service
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: Always
volumeMounts:
- name: config-volume
mountPath: /app/appsettings
volumes:
- name: config-volume
configMap:
name: appsettings-config-map-plc-in-scale-service
items:
- key: appsettings.XXX.json
path: appsettings.Development.json
nodeSelector:
beta.kubernetes.io/os: linux
schedulerName: default-scheduler
imagePullSecrets:
- name: ...
...
【问题讨论】:
标签: kubernetes azure-aks nginx-ingress