kubectl expose --type = LoadBalancer无效

时间:2015-08-06 11:26:43

标签: kubernetes

在发布以下json对象(排除变量)后,我遇到了一些外部ip地址的问题:

$json= '{
          "kind": "Service",
          "apiVersion": "v1",
          "metadata": {
            "name": ""
          },
          "spec": {
            "ports": [{
              "port": 80,
              "targetPort": 80
            }],
            "selector": {
              "app": ""
            },
            "type": "LoadBalancer"
          }
}';

已创建服务但未提供外部IP。

无法确定问题所在,我继续使用文档中提供的以下命令(V1 kubernetes / examples / simple-nginx.md)安装kubernetes(以及定义要安装的集群)的干净副本:

curl -sS https://get.k8s.io | bash

这当然会自动设置。然后我运行以下命令来测试LoadBalancer函数是否正常工作:

kubectl run my-nginx --image=nginx --replicas=2 --port=80

在运行kubectl get pods以确认它们已准备就绪后,我公开了服务:

kubectl expose rc my-nginx --port=80 --type=LoadBalancer

然后我在过去的几分钟内运行kubectl get service,并且没有提供公共IP ..

那不对吗?

修改

kubectl get services  

NAME         LABELS                                    SELECTOR       IP(S)          PORT(S)
kubernetes   component=apiserver,provider=kubernetes   <none>         10.0.0.1       443/TCP
my-nginx     run=my-nginx                              run=my-nginx   10.0.136.163   80/TCP


kubectl get service my-nginx -o yaml  

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: 2015-08-11T11:44:02Z
  labels:
    run: my-nginx
  name: my-nginx
  namespace: default
  resourceVersion: "1795"
  selfLink: /api/v1/namespaces/default/services/my-nginx
  uid: 434751be-401e-11e5-a219-42010af0da43
spec:
  clusterIP: 10.x.xxx.xxx
  ports:
  - nodePort: 31146
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    run: my-nginx
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer: {}

运行后(感谢GameScripting):

kubectl describe service my-nginx

我看到以下错误:

FirstSeen               LastSeen            Count   From            SubobjectPath   Reason              Message
  Tue, 11 Aug 2015 14:00:00 +0200   Tue, 11 Aug 2015 14:02:41 +0200 9   {service-controller }           creating loadbalancer failed    failed to create external load balancer for service default/my-nginx: googleapi: Error 403: Quota 'FORWARDING_RULES' exceeded.  Limit: 15.0

1 个答案:

答案 0 :(得分:4)

手动删除&#34;网络 - &gt;负载均衡 - &gt;网络负载均衡&#34;下的转发规则(或者您可以使用gcloud compute forwarding-rules delete)我能够再次公开Ip&#39}。似乎某种方式转发规则没有被删除并达到了极限。奇怪的是,当我运行Kubectl stop service时,它为我删除了转发规则。