0

I have installed Nginx Ingress Controller by using this Link

From the above link. i have executed the below commands.

$ git clone https://github.com/nginxinc/kubernetes-ingress.git --branch v2.4.2
$ 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 -o wide
NAME                      READY   STATUS    RESTARTS   AGE   IP           NODE        NOMINATED NODE   READINESS GATES
pod/nginx-ingress-mfnk8   1/1     Running   0          18h   10.244.2.8   worker-3    <none>           <none>
pod/nginx-ingress-n4b79   1/1     Running   0          18h   10.244.1.6   worker-2    <none>           <none>
pod/nginx-ingress-ndtkw   1/1     Running   0          18h   10.244.3.5   worker-4    <none>           <none>

NAME                           DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE   CONTAINERS      IMAGES                      SELECTOR
daemonset.apps/nginx-ingress   3         3         3       3            3           <none>          18h   nginx-ingress   nginx/nginx-ingress:2.4.2   app=nginx-ingress
$ kubectl logs nginx-ingress-n4b79 -n nginx-ingress
I0111 09:17:11.242514       1 flags.go:199] Starting NGINX Ingress Controller Version=2.4.2 PlusFlag=false
I0111 09:17:11.242568       1 flags.go:200] Commit=4252538e0d02dfd42cd3b35884cd5b50147814b7 Date=2022-11-30T14:54:40Z DirtyState=false Arch=linux/amd64 Go=go1.19.3
I0111 09:17:11.249520       1 main.go:214] Kubernetes version: 1.24.9
I0111 09:17:11.257785       1 main.go:341] Using nginx version: nginx/1.23.2
2023/01/11 09:17:11 [notice] 24#24: using the "epoll" event method
2023/01/11 09:17:11 [notice] 24#24: nginx/1.23.2
2023/01/11 09:17:11 [notice] 24#24: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
2023/01/11 09:17:11 [notice] 24#24: OS: Linux 5.4.0-132-generic
2023/01/11 09:17:11 [notice] 24#24: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2023/01/11 09:17:11 [notice] 24#24: start worker processes
2023/01/11 09:17:11 [notice] 24#24: start worker process 30
2023/01/11 09:17:11 [notice] 24#24: start worker process 31
2023/01/11 09:17:11 [notice] 24#24: start worker process 32
2023/01/11 09:17:11 [notice] 24#24: start worker process 33
2023/01/11 09:17:11 [notice] 24#24: start worker process 34
2023/01/11 09:17:11 [notice] 24#24: start worker process 35
2023/01/11 09:17:11 [notice] 24#24: start worker process 36
2023/01/11 09:17:11 [notice] 24#24: start worker process 37
2023/01/11 09:17:11 [notice] 24#24: start worker process 38
2023/01/11 09:17:11 [notice] 24#24: start worker process 39
2023/01/12 04:30:33 [notice] 24#24: signal 17 (SIGCHLD) received from 288
2023/01/12 04:30:33 [notice] 24#24: worker process 288 exited with code 0
2023/01/12 04:30:33 [notice] 24#24: worker process 282 exited with code 0
2023/01/12 04:30:33 [notice] 24#24: worker process 290 exited with code 0
2023/01/12 04:30:33 [notice] 24#24: worker process 304 exited with code 0
2023/01/12 04:30:33 [notice] 24#24: worker process 328 exited with code 0
2023/01/12 04:30:33 [notice] 24#24: worker process 315 exited with code 0
2023/01/12 04:30:33 [notice] 24#24: signal 29 (SIGIO) received
2023/01/12 04:30:33 [notice] 24#24: signal 17 (SIGCHLD) received from 290

When i tried to connect Nginx container using http://{Worker-IP}, Have tried with all three Worker-IPs. For all three it shows 404 Not Found on browser.

Nginx container Status shows Running & Ready shows (1/1). What could the problem? Also let me know Am i missing any additional installation commands?

$ kubectl get ingress --all-namespaces
NAMESPACE   NAME              CLASS    HOSTS                ADDRESS   PORTS   AGE
jenkins     jenkins-ingress   <none>   jenkins.company.com             80      19h
$ 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                  46h
jenkins       jenkins-svc   ClusterIP   10.103.54.142   <none>        80/TCP                   46h
kube-system   kube-dns      ClusterIP   10.96.0.10      <none>        53/UDP,53/TCP,9153/TCP   46h
user4948798
  • 1,924
  • 4
  • 43
  • 89
  • are you trying wiht node port service or LB service type ? if node port append it behind the workerIP and did you created the ingress resource. – Harsh Manvar Jan 12 '23 at 05:03
  • @Harsh Manvar - So i can't access my `nginx-ingress controller POD` with `http://{Worker-IP}`? I need to have `nginx resource file` to connect? To answer your question - Yes i have HA Proxy LB outside of my Kubernetes cluster. So in my application service side using `type: ClusterIP`. – user4948798 Jan 12 '23 at 05:10
  • which type your ingress controller service is ? check the svc type of nginx ingress controller and also share output of `kubectl get ingress --all-namespaces` – Harsh Manvar Jan 12 '23 at 05:13
  • any which type your service is nginx ingress svc ? – Harsh Manvar Jan 12 '23 at 05:16
  • i have Jenkins service. `kubectl get svc --all-namespaces` result added. – user4948798 Jan 12 '23 at 05:18
  • `kubectl get svc --all-namespaces` try this and show ouptut – Harsh Manvar Jan 12 '23 at 05:21
  • looks like there is not nginx ingress service for controller. – Harsh Manvar Jan 12 '23 at 05:22
  • Yes was thinking even here `kubectl get all -n nginx-ingress -o wide` output can't see Nginx ingress service. Any commands i missed as part of Nginx ingress installation? – user4948798 Jan 12 '23 at 05:23
  • there could be chances, let me check doc you followed once. trying on which cloud or minikube locally it is ? – Harsh Manvar Jan 12 '23 at 05:25
  • 1
    `Kubernetes v1.24.9 `cluster (One master and three workers) bare metal based. – user4948798 Jan 12 '23 at 05:27
  • did you runt the step 4. Get Access to the Ingress Controller ? there is node port and LB service execution code. – Harsh Manvar Jan 12 '23 at 05:27
  • 4.1 Create a Service for the Ingress Controller Pods `Use a NodePort service.` ` Create a service with the type NodePort:` `$ kubectl create -f service/nodeport.yaml` This step no i have not installed. – user4948798 Jan 12 '23 at 05:28
  • yes that's the main part to create the svc had doubt only as service missing.follow it please – Harsh Manvar Jan 12 '23 at 05:30
  • Now it runs `nginx-ingress nginx-ingress NodePort 10.104.207.132 80:32460/TCP,443:31396/TCP 4s app=nginx-ingress` but still i can't access my application using `http://jenkins.company.com/jenkins` – user4948798 Jan 12 '23 at 05:33
  • it won't like that way now set workerip in `/etc/hosts` and point it to jenkins.company.com and thn hit that with proper nodeport 31396 or 32460 and ingress. – Harsh Manvar Jan 12 '23 at 05:39
  • `jenkins.company.com` already existing in `/etc/host `file of all (master & workers). My jenkins application service running as `type: ClusterIP` But `Ngnix ingress` service created as `type NodePort` – user4948798 Jan 12 '23 at 05:44
  • that's fine from where you are trying to access jenkins.company.com ? – Harsh Manvar Jan 12 '23 at 06:06
  • Outside of cluster for example On my laptop. – user4948798 Jan 12 '23 at 06:09
  • and where is your master and worker running? your example my laptop can have access to worker IP ? can access it with IP or you are on some cloud and create multiple vms ? make sure local or laptop should be able to connect to workip, or your jenkin. should be proper in DNS which should be pointing to IP of LB if using it. – Harsh Manvar Jan 12 '23 at 06:19
  • Master, Workers and LB are running separately on VMs. In Master, Worker, LB and my laptop i have added `jenkins.company.com` entry along with LB IP address in host file. – user4948798 Jan 12 '23 at 06:34
  • if your nginx ingress controller is svc nodeport how you got the LB IP or which one you are suing ? if it's node port use the workerIP in `/etc/hosts` use node port and try to access it will work. http://workerip:nodeport/ as you have already mapped workerIP to hosts file it will be like http://jenkin.company.com:nodeport – Harsh Manvar Jan 12 '23 at 06:46
  • My jenkins application service runs as `type: ClusterIP` then nginx-ingress application service runs as `type: NodePort`, In my HAproxy LB added front and backend for my Kubernetes cluster (master & workers). – user4948798 Jan 12 '23 at 06:54
  • Basically i need to access my jenkins like `http://jenkins.company.com/jenkins` outside of cluster example on users systems. – user4948798 Jan 12 '23 at 06:57
  • https://stackoverflow.com/questions/58574104/kubernetes-nginx-ingress-controller-on-nodeport – Harsh Manvar Jan 12 '23 at 07:03
  • @user4948798 Has your issue been resolved? – Fariya Rahmat Jan 19 '23 at 10:50
  • @Fariya Rahmat Not yet. Found that my HAproxy not forwarding the request to Kubernetes nginx ingress controller, which I'm trying to address it. – user4948798 Jan 19 '23 at 12:16

0 Answers0