kubernetes-ingress: Nginx Ingress Controller gives 404 not found
### Cluster information:
Kubernetes version:1.24.9
Bare-Metal being used: (One master and three workers)
Installation method: Installed using Ansible.
Host OS: Ubuntu 18.04.6 LTS
CNI and version: Flannel ( rancher/mirrored-flannelcni-flannel - v0.19.2 )
CRI and version: containerd://1.4.6
I have installed Nginx Ingress Controller by using this link https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests
From the above link. i have executed the below commands.
$ git clone https://github.com/nginxinc/kubernetes-ingress.git --branch v3.0.0
$ cd kubernetes-ingress/deployments
$ kubectl apply -f common/ns-and-sa.yaml
$ kubectl apply -f rbac/rbac.yaml
$ kubectl apply -f common/default-server-secret.yaml
$ kubectl apply -f common/nginx-config.yaml
$ kubectl apply -f common/ingress-class.yaml
$ kubectl apply -f common/crds/k8s.nginx.org_virtualservers.yaml
$ kubectl apply -f common/crds/k8s.nginx.org_virtualserverroutes.yaml
$ kubectl apply -f common/crds/k8s.nginx.org_transportservers.yaml
$ kubectl apply -f common/crds/k8s.nginx.org_policies.yaml
$ kubectl apply -f common/crds/k8s.nginx.org_globalconfigurations.yaml
$ kubectl apply -f daemon-set/nginx-ingress.yaml
It is runs as a daemon set,
$ kubectl get all -n nginx-ingress
NAME READY STATUS RESTARTS AGE
pod/nginx-ingress-69z69 1/1 Running 0 26m
pod/nginx-ingress-l7z86 1/1 Running 0 26m
pod/nginx-ingress-wsjfv 1/1 Running 0 26m
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
daemonset.apps/nginx-ingress 3 3 3 3 3 <none> 26m
$ kubectl get svc --all-namespaces
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 3d1h
jenkins jenkins-svc ClusterIP 10.103.54.142 <none> 80/TCP 3d1h
kube-system kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 3d1h
$ kubectl get ingress --all-namespaces
NAMESPACE NAME CLASS HOSTS ADDRESS PORTS AGE
jenkins jenkins-ingress <none> jenkins.company.com 80 19h
$ kubectl describe ingress jenkins-ingress -n jenkins
Name: jenkins-ingress
Labels: <none>
Namespace: jenkins
Address:
Ingress Class: nginx
Default backend: <default>
Rules:
Host Path Backends
---- ---- --------
jenkins.company.com
/jenkins jenkins-svc:80 (10.244.2.19:8080)
Annotations: nginx.ingress.kubernetes.io/rewrite-target: /$2
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal AddedOrUpdated 9m4s nginx-ingress-controller Configuration for jenkins/jenkins-ingress was added or updated
Normal AddedOrUpdated 9m4s nginx-ingress-controller Configuration for jenkins/jenkins-ingress was added or updated
Normal AddedOrUpdated 9m4s nginx-ingress-controller Configuration for jenkins/jenkins-ingress was added or updated
$ kubectl exec -it -n nginx-ingress nginx-ingress-l7z86 -- curl -v -H "Host: nginx" localhost:80
* Trying ::1:80...
* Connected to localhost (::1) port 80 (#0)
> GET / HTTP/1.1
> Host: nginx
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Server: nginx/1.23.3
< Date: Fri, 13 Jan 2023 11:06:53 GMT
< Content-Type: text/html
< Content-Length: 153
< Connection: keep-alive
<
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.23.3</center>
</body>
</html>
* Connection #0 to host localhost left intact
My Jenkins service yaml file as follows,
apiVersion: v1
kind: Service
metadata:
name: jenkins-svc
namespace: jenkins
labels:
app: jenkins
spec:
selector:
app: jenkins
type: ClusterIP
ports:
- protocol: TCP
port: 80
targetPort: 8080
My ingress-resource.yaml file as follows
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
name: jenkins-ingress
namespace: jenkins
spec:
ingressClassName: nginx
rules:
- host: jenkins.company.com
http:
paths:
- path: /jenkins
pathType: Prefix
backend:
service:
name: jenkins-svc
port:
number: 80
When i tried to access our jenkins URL http://jenkins.company.com/jenkins getting 404 Not Found error on browser.
What could the problem? Also let me know Am i missing any additional installation commands?
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 22 (11 by maintainers)
Thanks for the information. I shall check and come back soon as possible. Thank you!
Hi Shaun, Yes it was resolved and thanks a lot for your kind support š. Appreciate your help on this
Hi Shaun,
Requested output as follows.
Thanks Shaun for assisting me. My
deployment.ymlfile as follows.Thanks for all the details Mohan. Iām looking into this now and will get back to you asap.