My yaml files for various deployments, services and ingresses have created a working setup before. I tried fixing a small issue with an ingress and can't get back to a working state.

My pods start without error and the services are up and running. The logs have no health check entries so the issue seems to be in getting the services to be contacted by name. When the ingress in creating, I see this event in the GKE interface (and not when using kubectl describe):

Error during sync: error while evaluating the ingress spec: could not find service "default/web";

The service is indeed up:

NAME            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
elasticsearch   ClusterIP   None            <none>        9200/TCP,9300/TCP            5h
kubernetes      ClusterIP   10.31.x.x       <none>        443/TCP                      5h
redis-master    ClusterIP   10.31.x.x       <none>        6379/TCP                     5h
web             NodePort    10.31.x.x       <none>        80:30110/TCP,443:31404/TCP   5h
websocket       NodePort    10.31.x.x       <none>        28080:30186/TCP              5h

I've tried restarting services and changing to an nginx ingress. My only remaining idea is to nuke the cluster. It's as if the k8s internal DNS is broken.

  • are these services in the default namespace? – Patrick W Aug 8 '18 at 16:05
  • 1
    Yes. I actually already solved this and will post an answer shortly. I run the rails puma server on port 3000 but I had made a change to enable force_ssl. This lost the port which meant that the service was detected as unhealthy. There were also no log indications of requests. Wrong port -_- – Archonic Aug 8 '18 at 17:13
  • Would you mind posting you solution as an answers, so this case question can be considered as solved. – mehdi sharifi Aug 10 '18 at 14:41

I had both port 80 and 443 pointing to 3000 for the web service where my Rails app was running. I enabled force_ssl in the Rails configuration. I figured all this would do is redirect http requests to https, but it turns out this resets the port you're serving on. You need to specify the port if you want to enable force_ssl: https://github.com/rails/rails/issues/19820

Because port 3000 was no longer responding with 200, that service was marked unhealthy, despite nothing otherwise being wrong with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.