简体   繁体   English

Kubernetes:入口没有 IP 地址

[英]Kubernetes: Ingress doesn't have IP address

I setup a 3 nodes K8S cluster locally with virtualbox.我用 virtualbox 在本地设置了一个 3 节点的 K8S 集群。 When I try out the ingress, it doesn't setup the IP address:当我尝试入口时,它没有设置 IP 地址:

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?您正在运行 Ingress 控制器吗? A minimal Kubernetes cluster does not have an Ingress controller by default.默认情况下,最小的 Kubernetes 集群没有 Ingress 控制器。 If not, try deploying this controller: https://github.com/kubernetes/ingress-nginx如果没有,请尝试部署此控制器: 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). Ingress 是一个仅提供配置的对象,而不是活动组件(例如 Pod 或 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.正如 coreypobrien 所说,您需要部署一个 Ingress 控制器,它将读取您在集群中部署的入口并相应地更改其配置。

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在这个页面你可以找到官方kubernetes入口控制器的文档,基于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/另一种选择是 traefik 入口控制器: 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您可以通过在种类服务(在入口 yaml 中)的规范块中添加“externalIPs”参数来做到这一点,如下所示

  --snip--
  externalIPs:
    - 192.168.1.54

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取 Kubernetes Ingress 端点/IP 地址 - Getting an Kubernetes Ingress endpoint/IP address Kubernetes:Nginx Ingress不提供外部IP地址 - Kubernetes: Nginx Ingress not providing external IP address 如何在 Kubernetes 上使用 GKE 入口 controller 保留客户端 IP 地址? - How to preserve Client IP Address with GKE Ingress controller on Kubernetes? kubernetes 入口从哪里获得其 IP 地址? - Where does a kubernetes ingress gets its IP address from? Kubernetes/Ingress/TLS - 使用 URL 中的 IP 地址阻止访问 - Kubernetes/Ingress/TLS - block access with IP Address in URL 带有Kubernetes的Ingress-Nginx没有获得IP地址 - Ingress-Nginx w/ Kubernetes not getting IP address 使用 Kubernetes Python 客户端获取 Ingress 网关 IP 地址 - Get Ingress gateway IP address using Kubernetes Python client 如何使用 Terraform 为 Kubernetes 入口分配静态 IP 地址? - How to assign a static ip address to an Kubernetes ingress using Terraform? Kubernetes Nginx Ingress Connection Refused on External IP Address (Bare Metal) - Kubernetes Nginx Ingress Connection Refused on External IP Address (Bare Metal) Configuring Static IP address with Ingress Nginx Sticky Session on Azure Kubernetes - Configuring Static IP address with Ingress Nginx Sticky Session on Azure Kubernetes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM