kubernetes minikube ingress远程访问

thigvfpy  于 2023-10-17  发布在  Kubernetes
关注(0)|答案(2)|浏览(126)

我有一个Nginx服务运行在minikuve虚拟机具有ip 192.168.99.106

kubectl get ingress 

`NAME              CLASS    HOSTS   ADDRESS          PORTS   AGE`
`ingress-service   <none>   *       192.168.99.106   80      153m`

kubectl describe ingress

Name:             ingress-service
Namespace:        default
Address:          192.168.99.106
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)

Rules:
  Host        Path  Backends
  ----        ----  --------
  *           
              /                fe-cluster-ip-service:3000 (172.17.0.20:3000)
              /login/       login-cluster-ip-service:9090 (172.17.0.18:9090)
            
Annotations:  kubernetes.io/ingress.class: nginx
Events:       <none>

我想向外界公开端口192.168.99.106:80,以便我能够从10.105.230.34:8888访问应用程序

enp129s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet **10.105.230.34**  netmask 255.255.255.0  broadcast 10.105.230.255
        inet6 fe80::2be:75ff:fee1:57ce  prefixlen 64  scopeid 0x20<link>
        ether 00:be:75:e1:57:ce  txqueuelen 1000  (Ethernet)
        RX packets 3441670  bytes 4623846194 (4.3 GiB)
        RX errors 0  dropped 38  overruns 0  frame 0
        TX packets 971511  bytes 235934965 (225.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xfbc00000-fbcfffff

是否可以实现此功能。我试过挖隧道,但没成功

des4xlb0

des4xlb01#

我通过使用反向代理nginx到minikube ip来解决它。

cld4siwp

cld4siwp2#

您需要访问service,而不是ingress
您可以在集群主机中运行以下命令。
kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard 8099:80 --address 0.0.0.0
然后您可以访问::8099

相关问题