Kubernetes Ingress Path only works with

0 votes

I have configured a kubernetes ingress service but it only works when the path is /

I have tried all manner of different values for the path including:

/*
/servicea
/servicea/
/servicea/*

This is my ingress configuration (that works)

- apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: boardingservice
    annotations:
      ingress.kubernetes.io/rewrite-target: /
  spec:
    rules:
    - host: my.url.com
      http:
        paths:
        - path: /
          backend:
            serviceName: servicea-nodeport
            servicePort: 80

This is my nodeport service

- apiVersion: v1
  kind: Service
  metadata:
    name: servicea-nodeport
  spec:
    type: NodePort
    ports:
    - port: 80
      targetPort: 8081
      nodePort: 30124
    selector:
      app: servicea

And this is my deployment

- apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: servicea
  spec:
    replicas: 1
    template:
      metadata:
        name: ervicea
        labels:
          app: servicea
      spec: 
        containers:
        - image: 350329402011.dkr.ecr.eu-west-2.amazonaws.com/servicea
          name: servicea
          ports: 
          - containerPort: 8080
            protocol: TCP              
        - image: 350329402011.dkr.ecr.eu-west-2.amazonaws.com/serviceb
          name: serviceab
          ports: 
          - containerPort: 8081
            protocol: TCP  

If the path is / then I can do this http://my.url.com/api/ping but as I will have multiple services I want to do this: http://my.url.com/servicea/api/ping but when I set the path to /servicea I get a 404.

I am running kubernetes on AWS with an ingress-nginx ingress controller

Sep 7, 2018 in Kubernetes by lina
• 8,220 points
2,749 views

1 answer to this question.

0 votes

Have you changed the context path in your application that are running in the containers? You need to change the context path to match the ingress path.

Try this and let me know if it works.

answered Sep 7, 2018 by Kalgi
• 52,350 points
Ohhh thanks that works now!

Related Questions In Kubernetes

+5 votes
2 answers

Redirecting host to service path in kubernetes

What you are trying to do is ...READ MORE

answered Mar 27, 2018 in Kubernetes by DragonLord999
• 8,450 points
3,599 views
0 votes
1 answer

Kubernetes Endpoints with TTL

Follow these steps: add an annotation to each ...READ MORE

answered Aug 27, 2018 in Kubernetes by Kalgi
• 52,350 points
788 views
0 votes
2 answers

DNS does not resolve with NGINX in Kubernetes

adding to @kalgi's answer Using just the hostname ...READ MORE

answered Aug 30, 2018 in Kubernetes by Nilesh
• 7,060 points
5,656 views
0 votes
1 answer

Forcing ssl for Kubernetes Ingress on GKE

https://github.com/kubernetes/ingress-gce#frontend-https If you want to block http, you ...READ MORE

answered Sep 6, 2018 in Kubernetes by ajs3033
• 7,300 points
4,239 views
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
15,572 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,059 views
0 votes
1 answer

Issue with Kubernetes ingress routing to Nextjs applications

You’re using nginx ingress controller which does ...READ MORE

answered Sep 11, 2018 in Kubernetes by Kalgi
• 52,350 points
2,542 views
+1 vote
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP