在 service.beta.kubernetes.io/aws-load-balancer-type 注释中指定 nlb 时创建的经典负载均衡器

Classic load balancer created when specifying nlb in service.beta.kubernetes.io/aws-load-balancer-type annotation

我正在这样定义一个 kubernetes 服务:

kind: Service
apiVersion: v1
metadata:
  name: de-identity-svc
  labels:
    app: api-identity
    environment: de
    product: api
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags: "app=api-identity,environment=de,product=api"
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
    service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
spec:
  type: LoadBalancer
  selector:
    app: api-identity
    environment: de
  ports:
  - port: 80
    protocol: TCP

但是,当在 AWS 中创建负载均衡器时,它是使用类型 Classic 而不是预期的 network.

创建的

编辑

kubernetes 版本信息是这样的:

Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.4", GitCommit:"9befc2b8928a9426501d3bf62f72849d5cbcd5a3", GitTreeState:"clean", BuildDate:"2017-11-20T05:28:34Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.11", GitCommit:"b13f2fd682d56eab7a6a2b5a1cab1a3d2c8bdd55", GitTreeState:"clean", BuildDate:"2017-11-25T17:51:39Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

编辑 2

@vdMeent notes, this feature was added in Kubernetes 1.9 (https://aws.amazon.com/blogs/opensource/network-load-balancer-support-in-kubernetes-1-9/)

您应该将服务器 Kubernetes 版本升级到 1.9 或更高版本,因为 NLB 仅适用于 Kubernetes 1.9 and up。请注意,NLB 仍处于 alpha 阶段,因此您不应该将它用于任何实质性的东西,例如生产环境。