By Kamil Mańka
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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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
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
@velimattiahod6eb232fc97763 wow I’ve been beating my head against this particular wall for over 3 hours! Thank you so much!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.