简体   繁体   中英

Kubernetes: Ingress doesn't have IP address

I setup a 3 nodes K8S cluster locally with virtualbox. When I try out the ingress, it doesn't setup the IP address:

2017-11-11 17:00:49.015691 I | proto: duplicate proto type registered: 
google.protobuf.Any
2017-11-11 17:00:49.016061 I | proto: duplicate proto type registered: google.protobuf.Duration
2017-11-11 17:00:49.016112 I | proto: duplicate proto type registered: google.protobuf.Timestamp
NAME            HOSTS                     ADDRESS   PORTS     AGE
whale-ingress   a.whale.hey,b.whale.hey             80        9m

Ingress:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: whale-ingress
spec:
  rules:
  - host: a.whale.hey
    http:
      paths:
      - path: /
        backend:
          serviceName: whale-svc-a
          servicePort: 80
  - host: b.whale.hey
    http:
      paths:
      - path: /
        backend:
          serviceName: whale-svc-b
          servicePort: 80

Did I set something wrong?

Are you running an Ingress controller? A minimal Kubernetes cluster does not have an Ingress controller by default. If not, try deploying this controller: https://github.com/kubernetes/ingress-nginx

An Ingress is an object that only provides a configuration, not an active component (such as a Pod or a Service). As coreypobrien said, you need to deploy an Ingress controller, which will read the ingresses you deployed in your cluster and change its configuration accordingly.

At this page you can find the documentation of the official kubernetes ingress controller, based on nginx https://github.com/kubernetes/ingress-nginx/blob/master/README.md

Another option is the traefik ingress controller: https://docs.traefik.io/user-guide/kubernetes/

I had the same problem and I solved it by hard coding address in ingress controller. You can do it by adding "externalIPs" parameter in spec block of kind service (in ingress yaml) like bellow

  --snip--
  externalIPs:
    - 192.168.1.54

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM