skip to Main Content

But it show 404 page not found when i hit it in browser. Please tell me where the issue

nginx-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80

nginx-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: nginx-service
  labels:
    app: nginx
    svc: test-nginx
spec:
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 80
NAME                                 TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
ingress-nginx-controller             LoadBalancer   10.100.21.122    <pending>     80:30237/TCP,443:30080/TCP   14h
ingress-nginx-controller-admission   ClusterIP      10.100.248.124   <none>        443/TCP                      14h
kubernetes                           ClusterIP      10.96.0.1        <none>        443/TCP                      14h
nginx-service                        ClusterIP      10.107.238.84    <none>        8080/TCP                     14h

nginx-ingress.yaml file

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-app-ingress
spec:
  rules:
  - host: ingress-lb-2018265909.us-east-2.elb.amazonaws.com
    http:
      paths:
      - pathType: Prefix
        path: /
        backend:
          service:
            name: nginx-service
            port:
              number: 8080

2

Answers


  1. Chosen as BEST ANSWER

    Thanks everyone I get my answer . I need to setup metalLB to setup ingress in bare metal server


  2. External Ip of the LoadBalancer service being Pending may be your problem. check logs to see if you reach the Nginx Controller Pod.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search