How to (re) use an existent static IP address when creating a TLS Ingress Resource?

9/23/2016

I'm creating an (tls enabled) ingress resource using following configurations:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-app-apis
spec:
  tls:
  - secretName: tls-secret
  backend:
    serviceName: my-web-service
    servicePort: 80

A new static IP address is provisioned everytime. Is it possible to reuse an existent one ?

(I'm using Kubernetes running on GKE)

-- Fábio Uechi
google-compute-engine
google-kubernetes-engine
kubernetes

2 Answers

9/25/2016

Have you followed this tutorial for creating ingress object: https://cloud.google.com/container-engine/docs/tutorials/http-balancer?

If i remember correctly (also I use http not https) I had to assign static IP to GLBc manually:

https://cloud.google.com/compute/docs/reference/latest/globalForwardingRules:

Value of the reserved IP address that this forwarding rule is serving on behalf of. For global forwarding rules, the address must be a global IP; for regional forwarding rules, the address must live in the same region as the forwarding rule. If left empty (default value), an ephemeral IP from the same scope (global or regional) will be assigned.

-- Maciek Sawicki
Source: StackOverflow

10/7/2016

You can specify the IP address in an annotation on the Ingress (it looks like you specify it by name rather than IP address). This is only picked up by the GCE controller so don't expect it to work anywhere other than GCE/GKE.

https://github.com/kubernetes/contrib/blob/master/ingress/controllers/gce/controller/utils.go#L48

Something like this should work:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
 name: myingress
 annotations:
   "kubernetes.io/ingress.global-static-ip-name": my-ip-name
spec:
  ...
-- crb
Source: StackOverflow