我正在嘗試在 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