我正在尝试在 AWS 中创建一个内部(无外部 IP)第 4 层负载均衡器 - 网络 LB 或经典 LB - 用于内部流量管理,而不是使用 kube-proxy。
下面是我的清单文件 - 无论我如何指定注释,它都会不断创建外部 LB。我尝试过不使用“aws-load-balancer-type”注释以及“aws-load-balancer-scheme”(默认为“内部”)。我不确定下一步该尝试什么。(我接下来可能会尝试第 7 层 LB。)
% k get svc|grep test
test-internal-lb LoadBalancer 10.100.253.178 a29xxx.us-west-2.elb.amazonaws.com 80:xxx/TCP,443:xxx/TCP 8s
apiVersion: v1
kind: Service
metadata:
name: test-internal-lb
annotations:
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
service.beta.kubernetes.io/aws-load-balancer-scheme: internal
service.beta.kubernetes.io/aws-load-balancer-type: nlb-ip
spec:
type: LoadBalancer
selector:
app: test-app
ports:
- name: http
protocol: TCP
port: 80
targetPort: 8080
- name: https
protocol: TCP
port: 443
targetPort: 8080
答案1
解决方案:
test-app LoadBalancer 172.20.40.154 internal-a03xxx.us-west-2.elb.amazonaws.com 80:8000/TCP 11d
kind: Service
metadata:
name: test-app
annotations:
service.beta.kubernetes.io/aws-load-balancer-internal: “true”
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "http"
spec:
type: LoadBalancer
externalTrafficPolicy: Local
selector:
app: test-app
ports:
- name: http
protocol: TCP
port: 80
targetPort: 8000