probem with nginx ingress controller

10/8/2020

I have a baremetal kubernetes cluster running on RHEL7 with one master and three worker nodes. I am trying to setup ingress-nginx for the baremetal and everything looks good but for some reason, I still can't access my sample nginx deployment I created.

I followed the following steps:

  1. Apply ingress-nginx baremetal kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.40.2/deploy/static/provider/baremetal/deploy.yaml
  2. Verify that everything is working as expected in namespace ingress-nginx enter image description here
  3. Tried visiting the http://NODEIP:30548 (since Nginx ingress exposed to 30548 on NodePort) and I get 404 not found. Tried it for all nodes in my cluster and get 404. I think that means a good sign that my ingress controller is working as expected.
  4. Created a deployment as seen below:
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    run: nginx
  name: nginx-test-deploy
spec:
  replicas: 3
  selector:
    matchLabels:
      run: nginx-test
  template:
    metadata:
      labels:
        run: nginx-test
    spec:
      containers:
      - image: nginx
        name: nginx
  1. Exposed Service

    kubectl expose deploy nginx-test-deploy --port 80

  2. Created Ingress as seen below:

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: ingress-resource-1
spec:
  rules:
  - host: nginx.example.com
    http:
      paths:
      - backend:
          serviceName: nginx-test-deploy
          servicePort: 80
  1. Made a Host Entry for nginx.example.com in my local computer pointing to one of my nodes in cluster

Instead of seeing nginx landing page, it just doesn't resolve at all.

Can someone please guide me to figure out what might be going on?

Also I see that on two worker nodes, I see that pods are in "Completed" status and one is running. Is that expected behavior?

-- Andy Johnson
kubernetes
nginx-ingress

0 Answers