简体   繁体   English

503 Service Temporarily Unavailable use EKS ALB Ingress

[英]503 Service Temporarily Unavailable use EKS ALB Ingress

creating ALB with ALB Ingress Controller on eks在 eks 上使用 ALB 入口 Controller 创建 ALB

Title error returned when creating ALB and accessing domain创建 ALB 访问域时返回标题错误

503 Service Temporarily Unavailable

service and deployment look like this服务和部署看起来像这样

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sample-app-b-deployment
  namespace: default
spec:
  selector:
    matchLabels:
      app: sample-app-b
  template:
    metadata:
      labels:
        app: sample-app-b
    spec:
      containers:
        - name: app-container
          image: XXXXXXXXXXXX.dkr.ecr.ap-northeast-1.amazonaws.com/sample:c97e4bdeb61ba6196479f0b0f92347fcba828ff5
          ports:
            - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: app-b-service
  namespace: default
spec:
  type: NodePort
  ports:
    - port: 80
      targetPort: 8080
      protocol: TCP
  selector:
    app.kubernetes.io/name: sample-app-b
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sample-app-a-deployment
  namespace: default
spec:
  selector:
    matchLabels:
      app: sample-app-a
  template:
    metadata:
      labels:
        app: sample-app-a
    spec:
      containers:
        - name: app-container
          image: XXXXXXXXXXXX.dkr.ecr.ap-northeast-1.amazonaws.com/sample:c97e4bdeb61ba6196479f0b0f92347fcba828ff5
          ports:
            - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: app-a-service
  namespace: default
spec:
  type: NodePort
  ports:
    - port: 80
      targetPort: 8080
      protocol: TCP
  selector:
    app.kubernetes.io/name: sample-app-a

ingress is like this入口是这样的

---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: alb-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80},{"HTTPS": 443}]'
    alb.ingress.kubernetes.io/certificate-arn: my-arn
    alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
spec:
  rules:
    - host: example.com
      http:
        paths:
          - path: /*
            backend:
              serviceName: ssl-redirect
              servicePort: use-annotation
          - path: /
            backend:
              serviceName: app-a-service
              servicePort: 80
          - path: /app-a
            backend:
              serviceName: app-a-service
              servicePort: 80
          - path: /app-b
            backend:
              serviceName: app-b-service
              servicePort: 80

The ALB has been created and a record set has been registered in Route53.已创建 ALB,并已在 Route53 中注册记录集。 I don't know what the cause is because the log doesn't flow on the Cloud Watch.我不知道是什么原因,因为日志没有在 Cloud Watch 上流动。

If necessary, I will show the application code.如有必要,我将显示应用程序代码。

I have no idea where this error is occurring.我不知道这个错误发生在哪里。

Can anyone tell me?谁能告诉我?

Thank you.谢谢你。

fix selector修复选择器

apiVersion: v1
kind: Service
metadata:
  name: app-a-service
  namespace: default
spec:
  type: NodePort
  ports:
    - port: 80
      targetPort: 8080
      protocol: TCP
  selector:
    app: sample-app-a

I think that the reason is that the label of deployment did not match我认为原因是部署的label不匹配

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM