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달 전1276회 조회
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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠