入口不会更新ALB

时间:2019-09-25 12:56:15

标签: amazon-web-services kubernetes kubernetes-ingress aws-alb

我在EKS集群上运行的AWS上有ALB。我正在尝试在路由上的Ingress资源中应用更改,以便它指向不同的后端。

以下Ingresses的唯一区别是后端规范。

为什么更新不起作用?如何在ALB上更新路由?

原始入口:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/backend-protocol: HTTP
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}]'
  labels:
    app: api    
    type: ingress
spec:  
  backend:
    serviceName: api-service
    servicePort: 80 

更新入口:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/backend-protocol: HTTP
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}]'
  labels:
    app: api    
    type: ingress
spec:  
  backend:
    serviceName: offline-service
    servicePort: 9001 

控制器:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: alb-ingress-controller
  name: alb-ingress-controller
  namespace: kube-system
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: alb-ingress-controller
  template:
    metadata:
      labels:
        app.kubernetes.io/name: alb-ingress-controller
    spec:
      containers:
        - name: alb-ingress-controller
          args:           
            - --ingress-class=alb
            - --cluster-name=cluster-22           
          env:           
            - name: AWS_ACCESS_KEY_ID
              value: key           
            - name: AWS_SECRET_ACCESS_KEY
              value: key          
          image: docker.io/amazon/aws-alb-ingress-controller:v1.1.3
      serviceAccountName: alb-ingress-controller 

1 个答案:

答案 0 :(得分:0)

从评论中发布信息作为答案(社区Wiki):

  

经常发生的是,入口中定义的服务之一   是无法到达的,此时ALB入口控制器决定   它不会更新AWS ALB中的任何规则。

     

您必须部署脱机服务。