I have created a new reserved static IP in my GCP. See the screenshot marker 1. However my ingress resource is still using the generated ip (screenshot marker 2.)
In the Ingress' YAML file you can see I annotated the static-ip name.
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
ingress.kubernetes.io/backends: '{"k8s-be-31465--b5c10175cf4f125b":"HEALTHY"}'
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-teamcity--b5c10175cf4f125b
ingress.kubernetes.io/target-proxy: k8s-tp-default-teamcity--b5c10175cf4f125b
ingress.kubernetes.io/url-map: k8s-um-default-teamcity--b5c10175cf4f125b
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"kubernetes.io/ingress.global-static-ip-name":"teamcity-static-ip"},"name":"teamcity","namespace":"default"},"spec":{"backend":{"serviceName":"teamcity","servicePort":8111}}}
kubernetes.io/ingress.global-static-ip-name: teamcity-static-ip
creationTimestamp: "2019-11-12T13:57:41Z"
generation: 1
name: teamcity
namespace: default
resourceVersion: "3433973"
selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/teamcity
uid: 6484482e-0554-11ea-af7d-42010a8400aa
spec:
backend:
serviceName: teamcity
servicePort: 8111
status:
loadBalancer:
ingress:
- ip: 35.190.86.15
That's why I am confused why it is not assigning it to the Ingress resource as expected.
It's in the name of the annotation: kubernetes.io/ingress.global-static-ip-name
, this works only with global IP.
And if you look at the screen your ip is a regional one: europe-west-1
.
Create a global IP, delete and recreate the ingress and it should work ;)