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,100 points
170 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 36,220 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,360 points
53 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
• 36,220 points
33 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
• 6,900 points
288 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,080 points
798 views
0 votes
3 answers

Error while joining cluster with node

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

answered Jan 17 in Others by anonymous
681 views
+3 votes
1 answer
+13 votes
2 answers
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
• 36,220 points
102 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.