Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define external ip for kubernetes ingress

I have question about kubernetes ingress.

I want to use ingress with my Amazon account and/or private cloud and want to assign external IP.

It is possible to assign external ip for services : Services documentation - chapter external IP but cannot find a way to do that for Ingress : Ingress documentation.

My question is direct especially to Kubernetes team. Similar question was asked by Simon in this topic : How to force SSL for Kubernetes Ingress on GKE 2 but he asked about GKE while I am interested in private cloud, AWS.

Thank you in advance.

[UPDATE]

Guys found that my question may was answered already in this topic. Actually answer that @anigosa put there is specific for GCloud. His solution won't work in private cloud neither in AWS cloud. In my opinion the reason for that is that he use type: LoadBalancer (which cannot be used in private cloud) and use loadBalancerIP property which will works only on GCloud(for AWS it cause error : "Failed to create load balancer for service default/nginx-ingress-svc: LoadBalancerIP cannot be specified for AWS ELB ").

like image 981
Tomasz S Avatar asked Oct 21 '16 12:10

Tomasz S


People also ask

What is ingress external IP?

Ingress is a functionality within OpenShift to streamline the allocation of External IP's for accessing to services in the cluster. Cluster administrators can designate a range of addresses using a CIDR notation which allows an application user to make a request against the cluster for an external IP address.

How can I get Kubernetes cluster IP from outside?

To reach the ClusterIp from an external computer, you can open a Kubernetes proxy between the external computer and the cluster. You can use kubectl to create such a proxy. When the proxy is up, you're directly connected to the cluster, and you can use the internal IP (ClusterIp) for that Service .


1 Answers

Looking at this issue, it seems you can define annotation on your service and map it to existing elastic ip. Something like that:

apiVersion: v1
kind: Service
metadata:
  name: my-service
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-eip-allocations: <>
spec:
  type: LoadBalancer
  selector:
    app: MyApp
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9376

Please note this will create ELB for this service, not ingress.

As an ingress is simply one service (=ELB) handling requests for many other services, it should be possible to do something similar for ingress, but I couldn't find any docs for it.

like image 125
Omer Levi Hevroni Avatar answered Oct 19 '22 19:10

Omer Levi Hevroni