无法在本地kubernetes集群中部署入口

时间:2018-03-12 22:21:31

标签: nginx kubernetes kubernetes-ingress

我尝试使用本地kubernetes集群中的入口控制器为我的两个Web应用程序设置前端。我按照[1]中概述的所有步骤和[2]中的详细说明进行操作。但到目前为止运气不好。我得到的错误如下:

Warning CreatingLoadBalancerFailed Error creating load balancer (will retry): failed to ensure load balancer for service default/frontend: error creating loadbalancer a58617b3f260011e8ad84fa163e0c90a: error creating loadbalancer {a58617b3f260011e8ad84fa163e0c90a
Kubernetes external service a58617b3f260011e8ad84fa163e0c90a 7b4db6f7-3fc1-4c07-a84d-5c15b46e3ac2 <nil> }: Expected HTTP response code [201 202] when accessing [POST https://host.xyz.com:9696/v2.0/lbaas/loadbalancers],
but got 409 instead
{"NeutronError": {"message": "Quota exceeded for resources: ['loadbalancer'].", "type": "OverQuota", "detail": ""}}

我的服务处于待处理状态。

到目前为止,我不知道在哪里查找问题,并希望得到任何建议。

清单yaml文件几乎与[2]相同,它只列出https接口。但这是为了完整性

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
   name: frontend
   annotations:
     ingress.kub.webernetes.io/rewrite-target: /
spec:
  tls:
  - secretName: ing-secret
  replicas: 1
  template:
    metadata:
      labels:
        k8s-app: nginx-ingress-lb
  containers:
  - args:
    - /nginx-ingress-controller
    - "--default-backend-service=$(POD_NAMESPACE)/default-http-backend"
    - "--default-ssl-certificate=$(POD_NAMESPACE)/ing-secret"
  env:
    - name: POD_NAME
      valueFrom:
        fieldRef:
          fieldPath: metadata.name
    - name: POD_NAMESPACE
      valueFrom:
        fieldRef:
          fieldPath: metadata.namespace
  image: "gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.5"
  rules:
  - host: host.xxx.com
    https:
      paths:
      - path: /app1
        backend:
          serviceName: app1
          servicePort: 8881
      - path: /app2
        backend:
          serviceName: app2
          servicePort: 8882
---
apiVersion: v1
kind: Service
metadata:
  name: frontend
spec:
  type: LoadBalancer
  ports:
  - name: https
    port: 443
    targetPort: https
  selector:
    k8s-app: nginx-ingress-lb

[1] https://kubernetes.io/docs/concepts/services-networking/ingress/

[2] https://hackernoon.com/setting-up-nginx-ingress-on-kubernetes-2b733d8d2f45

2 个答案:

答案 0 :(得分:1)

看起来kubernetes正在使用OpenStack lbaas来配置入口资源下的负载均衡器服务(请参阅错误日志中的https://host.xyz.com:9696/v2.0/lbaas/loadbalancers

AFAIK此错误表示已配置的负载均衡器数量已达到资源限制。我会向您的群集管理员提出问题。

答案 1 :(得分:0)

您的服务正在尝试在AWS中创建新的负载均衡器,并且超出了您所在区域的配额。我认为你有20个,因为这是默认值: https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_elastic_load_balancer

以下是有关如何申请限额增加的说明: https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html