本文介绍了minikube和ingress-nginx没有打开端口80的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是ingress-nginx的新手,我使用minikube使用 minikube附加组件启用了ingress 启用了它.当寻找与ingress-nginx相关的服务时,我运行 kubectl get services -n kube-system 并得到:

I'm new to ingress-nginx and I enabled it with minikube using minikube addons enable ingress. When looking for the services related to ingress-nginx, I ran kubectl get services -n kube-system and got:

NAME                                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
ingress-nginx-controller-admission   ClusterIP   10.96.141.138   <none>        443/TCP                  16m
kube-dns                             ClusterIP   10.96.0.10      <none>        53/UDP,53/TCP,9153/TCP   16m

注意到我缺少80端口,我运行了 kubectl describe service/ingress-nginx-controller-admission -n kube-system 并得到:

Noticing that I'm missing port 80, I ran kubectl describe service/ingress-nginx-controller-admission -n kube-system and got:

Name:              ingress-nginx-controller-admission
Namespace:         kube-system
Labels:            addonmanager.kubernetes.io/mode=Reconcile
                   app.kubernetes.io/component=controller
                   app.kubernetes.io/instance=ingress-nginx
                   app.kubernetes.io/name=ingress-nginx
Annotations:       <none>
Selector:          app.kubernetes.io/component=controller,app.kubernetes.io/instance=ingress-nginx,app.kubernetes.io/name=ingress-nginx
Type:              ClusterIP
IP:                10.96.141.138
Port:              https-webhook  443/TCP
TargetPort:        webhook/TCP
Endpoints:         172.17.0.3:8443
Session Affinity:  None
Events:            <none>

当尝试访问端点 https://ingress-nginx-controller-admission.kube-system.svc.cluster.local/foo 时,出现此错误:

When trying to access an endpoint https://ingress-nginx-controller-admission.kube-system.svc.cluster.local/foo, I get this error:

FetchError: request to https://ingress-nginx-controller-admission.kube-system.svc.cluster.local/foo failed, reason: unable to verify the first certificate

,尽管通过入口从Pod内击中端点/foo 效果很好.我一直在寻找 tls相关文档无效.在这方面的任何帮助将不胜感激.

, although hitting the endpoint /foo from within a pod through the ingress works just fine. I was looking into the tls related documentation to no avail. Any help on this would be much appreciated.

我已经为每个请求添加了 kubectl get svc -A 的输出:

I've added the output of kubectl get svc -A per request:

NAMESPACE     NAME                                 TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
default       auth-svc                             ClusterIP      10.100.218.231   <none>        4000/TCP                     13s
default       client-svc                           ClusterIP      10.106.143.107   <none>        3000/TCP                     12s
default       kubernetes                           ClusterIP      10.96.0.1        <none>        443/TCP                      37m
kube-system   ingress-nginx-controller-admission   ClusterIP      10.96.141.138    <none>        443/TCP                      36m
kube-system   kube-dns                             ClusterIP      10.96.0.10       <none>        53/UDP,53/TCP,9153/TCP       37m

推荐答案

运行 kubectl公开部署ingress-nginx-controller --target-port = 80 --type = NodePort -n kube-system 允许我从集群中的pod内访问入口.

running kubectl expose deployment ingress-nginx-controller --target-port=80 --type=NodePort -n kube-system allows me to access the ingress from within a pod in the cluster.

这篇关于minikube和ingress-nginx没有打开端口80的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 07:45