0
votes

I have created a Service as Load Balancer and tried accessing the service using Minikube tunnel. It is working.

When I tried creating Ingress for the service i get the IP as same as minikube IP and not the tunnel IP.

My ingress Controller is of type NodePort

NAMESPACE              NAME                                 TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
default                kubernetes                           ClusterIP   10.96.0.1        <none>        443/TCP                      18h
default                springboot                           NodePort    10.103.228.107   <none>        8090:32389/TCP               16h
ingress-nginx          ingress-nginx-controller             NodePort    10.98.92.81      <none>        80:31106/TCP,443:32307/TCP   17h
ingress-nginx          ingress-nginx-controller-admission   ClusterIP   10.99.224.119    <none>        443/TCP                      17h
kube-system            kube-dns                             ClusterIP   10.96.0.10       <none>        53/UDP,53/TCP,9153/TCP       18h
kubernetes-dashboard   dashboard-metrics-scraper            ClusterIP   10.100.23.18     <none>        8000/TCP                     16h
kubernetes-dashboard   kubernetes-dashboard                 ClusterIP   10.98.172.252    <none>        80/TCP                       16h

I tunnel this using:

minikube service  ingress-nginx-controller -n ingress-nginx --url
* Starting tunnel for service ingress-nginx-controller.
|---------------|--------------------------|-------------|------------------------|
|   NAMESPACE   |           NAME           | TARGET PORT |          URL           |
|---------------|--------------------------|-------------|------------------------|
| ingress-nginx | ingress-nginx-controller |             | http://127.0.0.1:58628 |
|               |                          |             | http://127.0.0.1:58629 |
|---------------|--------------------------|-------------|------------------------|
http://127.0.0.1:58628
http://127.0.0.1:58629
! Because you are using a Docker driver on windows, the terminal needs to be open to run it.

I get the Url as http://127.0.0.1:58628.

I now apply ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingresstest
spec:
  rules:
  - host: "ravi.com"
    http:
      paths:
      - pathType: Prefix
        path: /
        backend:
          service:
            name: springboot
            port:
              number: 8090

But the ingress addressed is exposed in

kubectl get ingress
NAME          CLASS    HOSTS      ADDRESS        PORTS   AGE
ingresstest   <none>   ravi.com   192.168.49.2   80      64m

I need the tunnel URL in ingress

2
Hello @user2924500, please provide more details: Which ingress do you use? Please also attach your configuration in .yaml files. Do you have some errors? What do want to achive?Mikołaj Głodziak
I have edited the descriptionuser2924500
I am using ingress-nginx-controlleruser2924500
When i tunnel my service i am able to access. But not able to access via Ingress. (Ingress Address is same as Minikube IP) . I am using --driver=dockeruser2924500

2 Answers

0
votes

Unfortunately you cannot have the tunnel URL in your ingress. Ingress is working as expected.

You can add minikube ingress by commmand: minikube addons enable ingress. After enabling ingress addon it is specifically stated that: After the addon is enabled, please run "minikube tunnel" and your ingress resources would be available at "127.0.0.1". This tunnel creates a route to services deployed with type LoadBalancer and sets their Ingress to their ClusterIP. You can find more info here.

So you can install ingress, but unfortunately it won't work the way you want it.

You should also know, that Minikube is mainly used for testing and learning purposes so some of it's features might not be ideal.

0
votes

I did the steps mentioned above.

and gave curl ravi.com

I get error message 301 moved. What i am doing wrong?