gcloud入口负载平衡器/静态IP [英] gcloud ingress loadbalancer / static ip

查看:270
本文介绍了gcloud入口负载平衡器/静态IP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置了默认的gce入口控制器,并使用入口资源设置为响应主机名称



拥有静态ip的优点(以我当前的观点)是你永远不知道在哪里配置你的域,它将永远保持相同的IP;而另一方面,你可以坚持尽可能多的服务,你想要它背后



我很新的使用这个gce负载均衡器,我可以依靠它,因为我会一个静态IP(意味着它永远不会改变)?或者是否有一层要添加一个静态ip到负载均衡器?



我在问,因为您可以设置服务资源的IP。但我还没有线索,但对这个lbc / ingress combo做了同样的处理 - 给入口分配了一个静态ip?



我检查过,似乎存在一些'转发'(静态IP到负载均衡器)...但我真的很感谢这个经验丰富的帮助,至少最终会清楚地理解这一切。

Best

解决方案

最后,我有一个可行的解决方案。你必须使用 loadBalancerIP:xxxx 来添加一个L4服务,在其中放置一个先前保留的静态IP,然后放置部署/ RC已有的选择器,如下所示:


更新[Nov-2017]:静态IP应该是区域性的,并且与群集在同一区域中



服务:

  apiVersion:v1 
类型:Service
元数据:
名称:nginx-ingress-svc
规格:
类型:LoadBalancer
loadBalancerIP:104.155.55.37#静态IP预分配。
端口:
- 端口:80
名称:http
- 端口:443
名称:https
选择器:
k8s-app: nginx-ingress-lb

控制器:

  apiVersion:v1 
类型:ReplicationController
元数据:
名称:nginx-ingress-rc
标签:
k8s-app :nginx-ingress-lb
spec:
replicas:1
选择器:
k8s-app:nginx-ingress-lb
模板:
metadata:
标签:
k8s-app:nginx-ingress-lb
规格:
容器:
- 图片:eu.gcr.io/infantium-platform-20/ nginx-ingress
imagePullPolicy:总是
名称:nginx-ingress
端口:
- containerPort:80
hostPort:80
- containerPort:443
hostPort:443
args:
- -nginx-configmaps = staging / nginx-staging-config

解决方案提示是源代码从这个例子中编辑: https://beroux.com/english/articles/kubernetes/ ?部分= 3



希望这有助于。


Having set the default gce ingress controller working with ingresses resources set to respond to hostnames

The advantage of having a static ip (in my very current point of view) is that you never wonder where to configure your domain to, it will always remain the same ip; and on the other side you can stick as much service as you want behind it

I'm quite new using this gce loadbalancer, can I rely on it as I would with a static ip (meaning it'll never change) ? Or is there a layer to add to point a static ip to a loadbalancer ?

I'm asking because you can set the ip of a service resource. But I have no clue yet about doing the same with this lbc/ingress combo — assigning a static ip to an ingress ?

I've checked around, there seem to exist some 'forwarding' (static ip to load balancer)… but I'd really appreciate some experienced help on this one, at least to end up understanding it all clearly

Best

解决方案

Finally I have a working solution. You gotta add an L4 Service using loadBalancerIP: x.x.x.x where you put a previously reserved static IP, and then put a selector that the deployment/RC already has, like this:

UPDATE [Nov-2017]: Static IP should be regional and in the same region as cluster

Service:

apiVersion: v1
kind: Service
metadata:
  name: nginx-ingress-svc
spec:
  type: LoadBalancer
  loadBalancerIP: 104.155.55.37  # static IP pre-allocated.
  ports:
    - port: 80
      name: http
    - port: 443
      name: https
  selector:
    k8s-app: nginx-ingress-lb

Controller:

apiVersion: v1
kind: ReplicationController
metadata:
  name: nginx-ingress-rc
  labels:
    k8s-app: nginx-ingress-lb
spec:
  replicas: 1
  selector:
    k8s-app: nginx-ingress-lb
  template:
    metadata:
      labels:
        k8s-app: nginx-ingress-lb
    spec:
      containers:
      - image: eu.gcr.io/infantium-platform-20/nginx-ingress
        imagePullPolicy: Always
        name: nginx-ingress
        ports:
        - containerPort: 80
          hostPort: 80
        - containerPort: 443
          hostPort: 443
        args:
        - -nginx-configmaps=staging/nginx-staging-config

Solution hint was sourced from this example: https://beroux.com/english/articles/kubernetes/?part=3

Hope this helps.

这篇关于gcloud入口负载平衡器/静态IP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆