我们在openshift环境中的设置如下。
命名空间 B 中的应用程序 A 通过路由和以下关于负载平衡的配置暴露出来。
haproxy.router.openshift.io/balance: roundrobin
haproxy.router.openshift.io/disable_cookies: 'True'
命名空间 D(同一集群)中的应用程序 C 被应用程序 A 通过(内部)服务调用。
目前,我们正在经历应用A的pods的良好负载平衡,这意味着pods的cpumemory使用量和requestssecond大致相同。
然而,通过服务调用的应用程序C显示(例如两个pods)平均requestssecond的比例为1:2。我在文档中能找到的唯一信息是,正常情况下,kubernetes应该对这种内部服务调用进行负载均衡。
sessionAffinity: None
也被设置了。
我们使用的是 Openshift v3.11.161 (Kubernetes v1.11)
. 有什么我不知道的吗?
编辑:服务对象。
apiVersion: v1
kind: Service
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: >
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"test","template":"test-template"},"name":"test-service","namespace":"namespace"},"spec":{"ports":[{"name":"8080-tcp","port":8080,"protocol":"TCP","targetPort":8080}],"selector":{"deploymentconfig":"test-dc"},"sessionAffinity":"None"}}
creationTimestamp: 'timestamp'
labels:
app: test
template: test-template
name:test-service
namespace: namespace
resourceVersion: '73875211'
selfLink: /test/test
uid: uid
spec:
clusterIP: x.y.z
ports:
- name: 8080-tcp
port: 8080
protocol: TCP
targetPort: 8080
selector:
deploymentconfig: test
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
谢谢你