Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including
Stack Overflow
, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this community
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I'm trying to set up a very simple Kubernetes cluster with frontend, backend and db services. Here is part of the Frontend service definition file:
apiVersion: v1
kind: Service
metadata:
name: frontend
labels:
tier: frontend
spec:
selector:
tier: frontend
ports:
- port: 80
nodePort: 30080
type: LoadBalancer
When I access the cluster's IP at port 30080 everything is working properly.
Now I'm trying to set up an Ingress that will work at port 80 (in preparation for deploying the cluster to Azure). I want to direct all HTTP traffic to the frontend, as this is the only HTTP service in my cluster. So the ingress definition file is as follows:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: zippori
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
backend:
serviceName: frontend
servicePort: 80
However, when I access http://minikube-ip I get the following very simple error:
default backend - 404
It is as if Ingress doesn't forward anything to my frontend, and just tries its own default backend.
How can I fix this?
–
The issue is with Ingress service.
In the Ingress kind yaml You are using annotation to define "ingress backend". For AKS it is "addon-http-application-routing" but for minikube what works out of the box is kubernetes.io/ingress.class: nginx
Updating Ingress with proper annotation should enable service for your minikube setup.