Hi Folks,
I have created ingrees controller using documentation provided by the Typhoon distribution.
kubectl create -R -f typhoon/addons/nginx-ingress/digital-ocean/
Next using deployment:
kubectl run nginx --image=nginx --replicas=2 --port=80
Exposing by service:
kubectl expose deployment nginx --name=nginx --port=80 --target-port=80
and next configuring ingress using configuration below:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: in.cloud.example.com
http:
paths:
- path: /
backend:
serviceName: nginx
servicePort: 80
When I tried to access page using browser or curl always end up with:
default backend - 404
Please help.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
@velimattiahod6eb232fc97763 wow I’ve been beating my head against this particular wall for over 3 hours! Thank you so much!
I had the same problem, solution was to add kubernetes.io/ingress.class: "public"
to your ingress? Typhoon nginx-ingress addon says on startup
W0415 06:05:49.439051 5 flags.go:164] only Ingress with class "public" will be processed by this ingress controller
Your ingress ->
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx
annotations:
kubernetes.io/ingress.class: "public"
spec:
rules:
- host: in.cloud.example.com
http:
paths:
- path: /
backend:
serviceName: nginx
servicePort: 80
Hey. Since I am no Kubernetes expert (yet :) ) I reached out to some of our engineers to take a look at your question. One of our engineers has suggested the following:
The ingress they posted specifies a service name nginx
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: in.cloud.example.com
http:
paths:
- path: /
backend:
serviceName: nginx
servicePort: 80
but the kubectl get all
output doesn’t have nginx service listed which seems like the issue
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default-backend ClusterIP 10.3.164.90 <none> 80/TCP 4h
nginx-ingress-controller ClusterIP 10.3.230.155 <none> 80/TCP,443/TCP 4h
the default backend - 404
response is from the pod default-backend
which the ingress controller falls back to if the ingress is misconfigured or there’s no matching hosts on the controller.
So it sounds like you need to specify nginx-ingress-controller instead of nginx in your configuration or create an nginx deployment frontend by an nginx service like this:
kind: Service
apiVersion: v1
metadata:
name: nginx
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
resources:
requests:
cpu: 10m
ports:
- containerPort: 80
Click below to sign up and get $100 of credit to try our products over 60 days!
Output from ingress name space: