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 po
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.