Kubernetes集群上没有入口地址

Kubernetes集群上没有入口地址

本文介绍了使用Nginx入口控制器的minikube Kubernetes集群上没有入口地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下内容:

ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: abcxyz
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: abcxyz
    http:
      paths:
      - path: /a/
        backend:
          serviceName: service-a
          servicePort: 80
      - path: /b/
        backend:
          serviceName: service-b
          servicePort: 80

kubectl describe ingress abcxyz的输出:

Name:             abcxyz
Namespace:        default
Address:
Default backend:  default-http-backend:80 (<none>)
Rules:
  Host    Path  Backends
  ----    ----  --------
  abcxyz
          /a/   service-a:80 (<none>)
          /b/   service-b:80 (<none>)
Annotations:
Events:
  Type    Reason  Age                From                      Message
  ----    ------  ----               ----                      -------
  Normal  CREATE  16m                nginx-ingress-controller  Ingress default/abcxyz
  Normal  UPDATE  12m (x2 over 15m)  nginx-ingress-controller  Ingress default/abcxyz

为什么地址为空?我已经使用helm install stable/nginx-ingress通过头盔安装了"nginx入口控制器",并且所有的Pod相关事件似乎运行良好.

Why is the address empty? I've installed the 'nginx ingress controller' through helm using helm install stable/nginx-ingress - and all of it's pods relevent seem to be running fine.

如何提供对入口的访问权限?

How can I provide access to the ingress?

推荐答案

类型

minikube ip

检索主IP.例如:

bash-3.2$ minikube ip
192.168.1.100

提供有关kubernetes集群的信息的命令是:

The command that provides information about the kubernetes cluster is:

bash-3.2$ kubectl cluster-info
Kubernetes master is running at https://192.168.1.100:8443
KubeDNS is running at https://192.168.1.100:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

您可以使用curl从主机上测试入口控制器:

You can test the ingress controller from the host machine using curl:

bash-3.2$ curl http://192.168.1.100:80
default backend - 404

最后,添加一个主机条目,以便能够使用名称来引用集群IP地址

Finally, add a host entry to be able to use a name to refer to the cluster IP address

/etc/hosts中添加:

192.168.1.100   abcxyz

这篇关于使用Nginx入口控制器的minikube Kubernetes集群上没有入口地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 22:09