Kubernetes-ingress: Ingress doesn't work with a nodejs image

Created on 21 Jul 2017  路  8Comments  路  Source: nginxinc/kubernetes-ingress

Hi I'm having trouble when im changing the image nginxdemos/hello to my own image that is running a nodejs app on port 7000

ReplicationController

apiVersion: v1
kind: ReplicationController
metadata:
  name: tea-rc
spec:
  replicas: 2
  template:
    metadata:
      labels:
        app: tea
    spec:
      containers:
      - name: tea
        image: mynode/image
        ports:
        - containerPort: 7000

Service

apiVersion: v1
kind: Service
metadata:
  name: tea-svc
  labels:
    app: tea
spec:
  ports:
  - port: 80
    targetPort: 7000
    protocol: TCP
    name: http
  selector:
    app: tea

Ingress

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: cafe-ingress
spec:
  tls:
  - hosts:
    - cafe.example.com
    secretName: cafe-secret
  rules:
  - host: cafe.example.com
    http:
      paths:
      - path: /tea
        backend:
          serviceName: tea-svc
          servicePort: 80

if i use the nginxdemos/hello image, everything seems to work.
what am i missing? Thanks in advance..

All 8 comments

Hi! Maybe you service targetPort doesn't match containerPort:
ReplicationController containerPort = 7000
Service targetPort = 700

@damour i already edited it. it should be 7000.

@rhomnickcoloma
What kind of errors are you seeing?
Could you look into the NGINX logs? To get extended logs, please uncomment https://github.com/nginxinc/kubernetes-ingress/blob/master/examples/complete-example/nginx-ingress-rc.yaml#L28 and redeploy the Ingress controller.

Thanks Guys! It's now working.

@rhomnickcoloma I think I might be experiencing a similar issue. How did you solve?

I am trying to a LoadBalancer and Ingress to send incoming traffic from the LoadBalancer to the deployment pods by sending traffic from port 80 on the LoadBalancer to port 3000 on the pod.

What ended up being your solution?

@rhomnickcoloma, how you solve this issue??

@rhomnickcoloma that's soooo lame.

what is the solution?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

toddams picture toddams  路  6Comments

martinlevesque picture martinlevesque  路  5Comments

edingroot picture edingroot  路  5Comments

aprisniak picture aprisniak  路  4Comments

RazaGR picture RazaGR  路  6Comments