Ingress Cotroller in EKS The Address is empty

0

When I create my apps,

apiVersion: v1
kind: Service
metadata:
  name: svc-shield
spec:
  type: ClusterIP
  ports:
  - port: 8080
    targetPort: 8080
  selector:
    env: shield
---
apiVersion: v1
kind: Service
metadata:
  name: svc-hydra
spec:
  type: ClusterIP
  ports:
  - port: 8080
    targetPort: 8080
  selector:
    env: hydra
---
apiVersion: v1
kind: Pod
metadata:
  name: shield
  labels:
    env: shield
spec:
  containers:
  - image: nigelpoulton/k8sbook:shield-ingress
    name: shield-ctr
    ports:
    - containerPort: 8080
    imagePullPolicy: Always
---
apiVersion: v1
kind: Pod
metadata:
  name: hydra
  labels:
    env: hydra
spec:
  containers:
  - image: nigelpoulton/k8sbook:hydra-ingress
    name: hydra-ctr
    ports:
    - containerPort: 8080
    imagePullPolicy: Always

then create my Ingress,

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: mcu-all
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: nginx
  rules:
  - host: shield.mcu.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: svc-shield
            port:
              number: 8080
  - host: hydra.mcu.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: svc-hydra
            port:
              number: 8080
  - host: mcu.com
    http:
      paths:
      - path: /shield
        pathType: Prefix
        backend:
          service:
            name: svc-shield
            port:
              number: 8080
      - path: /hydra
        pathType: Prefix
        backend:
          service:
            name: svc-hydra
            port:
              number: 8080

But When I describe my ingress, the ADDRESS is empty

kubectl get ingress

NAMECLASSHOSTSADDRESSPORTSAGE
mcu-allnginxhield.mcu.com,hydra.mcu.com,mcu.com807m8s
profile picture
已提问 8 个月前1263 查看次数
1 回答
2
已接受的回答

Hello,

From you ingress manifest, I see that you are using NGINX Ingress Controller, from this specification ingressClassName: nginx. You can either use the NGINX Ingress Controller or the AWS Load Balancer Controller to manage AWS Elastic Load Balancers for your Kubernetes cluster.

You can troubleshoot the issue by following the steps below:

  1. Ensure you have NGINX Ingress Controller pod in running state. Run the command below:
kubectl get pods -n ingress-nginx

Expected result should look like this:

NAME                                        READY   STATUS    RESTARTS   AGE
ingress-nginx-controller-79d66f886c-sh2tk   1/1     Running   0          18h

If you don't have any output returned, it implies that you do not have NGINX Ingress Controller installed in your cluster. Follow the instruction here to install it or you can install the AWS Load Balancer Controller add-on. If you intend to use the AWS Load Balancer Controller, then you will need to make a simple modification to your ingress manifest. Refer to the example here

  1. If you have the NGINX Ingress Controller installed, view the logs of the NGINX Ingress Controller pod for possible errors
kubectl logs -f ingress-nginx-controller-79d66f886c-sh2tk -n ingress-nginx

We have a comprehensive blog here on Exposing Kubernetes Applications: https://aws.amazon.com/blogs/containers/exposing-kubernetes-applications-part-3-nginx-ingress-controller/

AWS
Olawale
已回答 8 个月前
profile picture
专家
已审核 8 个月前
  • Thanks, now it is working, perfectly.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则