kubernetes - Service won't come up when using static IP on GKE -
i have allocated static ip on gcp account. then, updated application's service definition use in load balancer, so:
kind: service apiversion: v1 metadata: # unique key of service instance name: my-app-service spec: ports: # accept traffic sent port 80 - name: http port: 80 targetport: 5000 selector: # loadbalance traffic across pods matching # label selector app: web # create ha proxy in cloud provider # external ip address - *only supported # cloud providers* type: loadbalancer # use static ip allocated loadbalancerip: 35.186.xxx.xxx
if comment out last line , let gke allocate ephemeral public ip, service comes fine. ideas doing wrong?
based on advise in answer, created ingress
follows:
apiversion: extensions/v1beta1 kind: ingress metadata: name: myapp annotations: kubernetes.io/ingress.global-static-ip-name: "myapp" spec: backend: servicename: my-app-service serviceport: 80
now, see ingress
getting assigned right static ip. however, service
gets assigned (different) public ip. ingress
, service
not connected. if comment out type: loadbalancer
line, service
not assigned public ip, ingress
still not connect. default backend - 404
response when hitting static ip. have tried creating service , ingress in different orders , has not helped either.
if leave long enough, static ip routes traffic service, service stays stuck in external ip assignment:
$ kubectl service my-app-service name cluster-ip external-ip port(s) age my-app-service 10.x.x.x <pending> 80:31432/tcp 12m
you need create ingress
, use kubernetes.io/ingress.global-static-ip-name: "name-of-your-ip"
annotation on ingress kubernetes able find it.
you can find tutorial here: https://github.com/kelseyhightower/ingress-with-static-ip#tutorial
Comments
Post a Comment