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

时间:2017-12-14 18:30:04

标签: amazon-web-services kubernetes amazon-elb

我正在定义像这样的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所述,此功能已添加到Kubernetes 1.9(https://aws.amazon.com/blogs/opensource/network-load-balancer-support-in-kubernetes-1-9/

1 个答案:

答案 0 :(得分:2)

您应该将服务器Kubernetes版本升级到1.9或更高版本,因为NLB仅适用于Kubernetes 1.9 and up。请注意,NLB仍处于alpha状态,因此您不应将其用于生产环境等任何实质内容。