我是GKE和kubernetes的新手。我使用Google Click to Deploy在GKE上安装了弹性搜索。我还安装了nginx-ingress并通过HTTP基本身份验证(通过入口)保护了Elasticsearch服务。我创建了一个外部静态IP,并使用入口控制器服务配置中的loadBalancerIp字段将其分配给入口控制器。
问题:
这是我的入口配置:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/auth-realm: Authentication Required - ok
nginx.ingress.kubernetes.io/auth-secret: basic-auth
nginx.ingress.kubernetes.io/auth-type: basic
name: basic-ingress
namespace: default
spec:
rules:
- http:
paths:
- backend:
serviceName: elasticsearch-1-elasticsearch-svc
servicePort: 9200
path: /
这是入口控制器服务配置:
apiVersion: v1
kind: Service
metadata:
labels:
app: nginx-ingress
chart: nginx-ingress-1.6.15
component: controller
heritage: Tiller
release: nginx-ingress
name: nginx-ingress-controller
namespace: default
spec:
clusterIP: <Some IP>
externalTrafficPolicy: Cluster
loadBalancerIP: <External IP>
ports:
- name: http
nodePort: 30290
port: 80
protocol: TCP
targetPort: http
- name: https
nodePort: 30119
port: 443
protocol: TCP
targetPort: https
selector:
app: nginx-ingress
component: controller
release: nginx-ingress
sessionAffinity: None
type: LoadBalancer
答案 0 :(得分:1)
我的建议是使用2个负载均衡器,其中1个用于公共负载,而1个用于私有负载。要创建私有负载均衡器,您只需在元数据部分添加以下行
cloud.google.com/load-balancer-type: "Internal"
参考: https://cloud.google.com/kubernetes-engine/docs/how-to/internal-load-balancing