kubernetes ingress problems, how can i solve this?

Hello Everyone, I’m new around and learning Kubernetes as my next step in the world of the apps, I have created 2 simple apps, using the hashicorp/http-echo, one for an echo of apple and one for banana.

Then I created a new ingress resource that looks like this

apiVersion: extensions/v1beta1
kind: Ingress
  name: example-ingress
  annotations: /
  - http:
        - path: /apple
            serviceName: apple-service
            servicePort: 5678
        - path: /banana
            serviceName: banana-service
            servicePort: 5678

When I launched I’m unable to get anything from the loadbalancer IP, I though it was cert problem, So I went to the LoadBalancer and added a port fowarding rule with the https and added a cert in there using digital ocean itself(not sure if this was correct or I should create a cert manager in kubernetes itself)

when I use kubectl get svc I get

NAME                            TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)                      AGE
apple-service                   ClusterIP   <none>           5678/TCP                     18m
banana-service                  ClusterIP      <none>           5678/TCP                     26m
kubernetes                      ClusterIP       <none>           443/TCP                      57m
nginx-ingress-controller        LoadBalancer   80:30097/TCP,443:30260/TCP   49m
nginx-ingress-default-backend   ClusterIP    <none>           80/TCP 

and kubectl describe ingress gives me

Name:             example-ingress
Namespace:        default
Default backend:  default-http-backend:80 (<none>)
  Host  Path  Backends
  ----  ----  --------
        /apple    apple-service:5678 (<none>)
        /banana   banana-service:5678 (<none>)
Annotations:  /
  Type    Reason  Age   From                      Message
  ----    ------  ----  ----                      -------
  Normal  CREATE  23m   nginx-ingress-controller  Ingress default/example-ingress
  Normal  UPDATE  23m   nginx-ingress-controller  Ingress default/example-ingress

The problem is that first, my Loadbalancer IP is not that one, is and the current IP shown is pointing to one of the nodes, I have 3. And after that any IP i Try will just give me a 400 error.

Can anyone give me some guidance?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

THANK YOU SO MUCH FOR THIS. I’ve been playing around for 40min already and couldn’t understand what goes on. Yeah you just need to kubectl delete -f myfile.yml and kubectl create -f myfile.yml and it’s started to work. Been using kubectl apply -f myfile.yml all the time, though it’s the same effect as in docker-swarm…

I redid the tutorial and redid the ingress resource, this time when I created the ingress controller, it did pick up the correct IP. After that I relaunched the resource and was working correctly after some changes