Curl: no URL specified! when implementing ingress

Hi! I’m newbie on Kubernetes.

I’m implementing a basic cats/dogs voting app. You can find all .yaml file on my github repository GitHub - raul-parada/voting-app

The app is working in local using the IP and port provided by minikube “service” --url

However, I would like to be accessible from the outside. I’ve enabled the ingress addon on minikube. I’ve followed all the steps from this website Set up Ingress on Minikube with the NGINX Ingress Controller | Kubernetes
However, when I’ve tried to test the ingress by doing curl --resolve result.example.com:80:192.168.59.100, I get this error: curl: no URL specified!

I don’t know what I’m doing wrong.
Thank you for your help in advanced!

Hello and welcome to Kubernetes! It’s great that you have your application running locally and are looking to make it accessible from the outside.

From the curl command you’ve provided, there appears to be a small mistake. The --resolve flag is used to tell curl to resolve a specific host and port to an IP address, but you still need to provide the actual URL to curl. In other words, you’re missing the URL of the request after the --resolve flag.

Here’s how you can correct the command:

curl --resolve result.example.com:80:192.168.59.100 http://result.example.com

Make sure to replace 192.168.59.100 with the actual IP address where your minikube ingress is exposed. If you’re using minikube, typically you can get the IP address by running minikube ip.

Also, ensure that your Ingress resource in Kubernetes is properly configured to route requests to the service that’s part of your cats/dogs voting app deployment. The host in your Ingress resource should match the host you’re using in your curl command (result.example.com in this case).

Here’s an example of what your Ingress resource might look like:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: voting-app-ingress
spec:
  rules:
  - host: "result.example.com"
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: voting-app-service
            port:
              number: 80

Make sure your service (voting-app-service in this case) is named correctly and is exposing the right port.

Lastly, don’t forget to apply your Ingress resource:

kubectl apply -f your-ingress.yaml

Once you fix your curl command and ensure the Ingress is correctly set up, your application should be accessible from outside your cluster using the specified host. Remember to replace result.example.com with your actual domain if you have one or keep it if you’re just testing and have made the necessary changes to your local hosts file or provided the --resolve option to curl.

Thank you very much @snowhale. That was a great solution. I got the HTML structure of the website. However, I cannot access to this URL from outside the machine within the same network. For instance, in another PC I’ve tried to enter to the website “http://result.example.com” but doesn’t find the target. I have everything running correctly.
I’ve tried to modify the etc/hosts file to add the IP and target. Unfortunately, I get the same error.

Probably, I’m missing some concepts. Do you know what I’m missing? Thank you again!

1 Like