我在开发环境中使用了具有以下配置的minibike的粘性会话:
入口:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: gl-ingress
annotations:
nginx.ingress.kubernetes.io/affinity: cookie
kubernetes.io/ingress.class: "gce"
kubernetes.io/ingress.global-static-ip-name: "projects/oceanic-isotope-199421/global/addresses/web-static-ip"
spec:
backend:
serviceName: gl-ui-service
servicePort: 80
rules:
- http:
paths:
- path: /api/*
backend:
serviceName: gl-api-service
servicePort: 8080
Run Code Online (Sandbox Code Playgroud)
服务:
apiVersion: v1
kind: Service
metadata:
name: gl-api-service
labels:
app: gl-api
annotations:
ingress.kubernetes.io/affinity: 'cookie'
spec:
type: NodePort
ports:
- port: 8080
protocol: TCP
selector:
app: gl-api
Run Code Online (Sandbox Code Playgroud)
现在我已将我的项目部署到GKE粘性会话不再起作用.我相信原因是在GKE中配置的全局负载均衡器与NGINX Ingress控制器没有会话关联.任何人都有运气接线吗?任何帮助,将不胜感激.我想建立会话亲和性:客户端浏览器>负载均衡器>入口>服务.实际会话位于服务后面的pod中.它是一个API网关(用Zuul构建).