Kubernetes External Load Balancer Service on DigitalOcean

前端 未结 3 838
梦谈多话
梦谈多话 2021-02-04 16:30

I\'m building a container cluster using CoreOs and Kubernetes on DigitalOcean, and I\'ve seen that in order to expose a Pod to the world you have to create a Service with Type:

3条回答
  •  无人共我
    2021-02-04 17:04

    It is actually possible to expose a service through a floating ip. The only catch is that the external IP that you need to use is a little unintuitive.

    From what it seems DO has some sort of overlay network for their Floating IP service. To get the actual IP you need to expose you need to ssh into your gateway droplet and find its anchor IP by hitting up the metadata service:

    curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address
    

    and you will get something like

    10.x.x.x
    

    This is the address that you can use as an external ip in LoadBalancer type service in kubernetes.

    Example:

    kubectl expose rc my-nginx --port=80 --public-ip=10.x.x.x --type=LoadBalancer
    

提交回复
热议问题