GCP load balancer returns a 404 even after health check passes

10/5/2018

I have the following ingress configuration

kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: dev-ingress
  namespace: dev
  annotations:
    kubernetes.io/ingress.class: "gce"
    kubernetes.io/ingress.global-static-ip-name: "dev-ingress"
spec:
  tls:
    - secretName: something-net-tls
      hosts: 
        - something.net
    - host: myworking.something.net
      http:
        paths:
        - path: /rpc
          backend:
            serviceName: myworking-dev-service
            servicePort: 80

    - host: mynotworking.something.net
      http:
        paths:
        - path: /rpc/*
          backend:
            serviceName: mynotworking-dev-service
            servicePort: mainnet

mynotworking.yml service

 kind: Service
  apiVersion: v1
  metadata:
    name: mynotworking-dev-service
    namespace: dev
  spec:
    selector:
      app: mynotworking-node
    ports:
    - name: mainnet
      protocol: TCP
      port: 80
      targetPort: 8332
    type: NodePort

mynotworking statefulset

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mynotworking-stateful
  namespace: dev
spec:
  serviceName: mynotworking-dev-service
  replicas: 1
  selector:
    matchLabels:
      app: mynotworking-node
  template:
    metadata:
      labels:
        app: mynotworking-node
    spec:
      containers:
      - name: mynotworking-node
        image: asia.gcr.io/indiesquare-dev/bitcoin-node:v0.13.2-addrindex
        imagePullPolicy: Always
        ports:
        - containerPort: 8332 
        livenessProbe:
          httpGet:
              path: /rest/chaininfo.json
              port: 8332
          initialDelaySeconds: 60 #wait this period after staring fist time
          periodSeconds: 15  # polling interval
          timeoutSeconds: 15    # wish to receive response within this time period
        readinessProbe: 
          httpGet:
              path: /rest/chaininfo.json
              port: 8332
          initialDelaySeconds: 60 #wait this period after staring fist time
          periodSeconds: 15    # polling interval
          timeoutSeconds: 15  
        command: ["/bin/bash"]
        args: ["-c","some service"]
      nodeSelector:
        moduleName: mynotworking

All the health checks are passing.

However when I hit the url https://mynotworking.something.net/rpc/rest/chaininfo.json, it gives a 404 error.

The other service seems to run ok myworking.something.net/rpc

The only difference in the services is that GET myworking.something.net/rpc return response code 200 while https://mynotworking.something.net/rpc/rest/chaininfo.json should return response code 200

I have tried to set the path for mynotworking.something.net to /rpc/*.

I can't seem to find what is wrong with the ingress configuration.

EDIT

$gcloud compute  health-checks  describe k8s-be-32354--a7c308fd8694dead
checkIntervalSec: 75
creationTimestamp: '2018-10-05T03:37:19.335-07:00'
description: Kubernetes L7 health check generated with readiness probe settings.
healthyThreshold: 1
httpHealthCheck:
  port: 32354
  proxyHeader: NONE
  requestPath: /rest/chaininfo.json
id: '8793382711098769456'
kind: compute#healthCheck
name: k8s-be-32354--a7c308fd8694dead
selfLink: https://www.googleapis.com/compute/v1/projects/myproject/global/healthChecks/k8s-be-32354--a7c308fd8694dead
timeoutSec: 15
type: HTTP
unhealthyThreshold: 10
-- kosta
google-cloud-platform
google-kubernetes-engine
kubernetes-ingress

1 Answer

10/5/2018

In your ingress, for host: mynotworking.something.net

Please edit to - path: /rpc/* so that https://mynotworking.something.net/rpc/rest/chaininfo.json

is defined.

-- dany L
Source: StackOverflow