简体   繁体   中英

Migrate Classic Loadbalancer to Application Loadbalancer in EKS

I am trying to migrate my CLB to ALB. I know there is a direct option on the AWS loadbalancer UI console to do a migration. But I don't want to use that. I have a service file which deploys classic loadbalancer on EKS using kubectl.

apiVersion: v1
kind: Service
metadata:
  annotations: {service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: '3600',
    service.beta.kubernetes.io/aws-load-balancer-type: classic}
  name: helloworld
spec:
  ports:
  - {name: https, port: 8443, protocol: TCP, targetPort: 8080}
  - {name: http, port: 8080, protocol: TCP, targetPort: 8080}
  selector: {app: helloworld}
  type: LoadBalancer

I want to convert it into ALB. I tried the following approach but not worked.

apiVersion: v1
kind: Service
metadata:
  name: helloworld
spec:
  ports:
  - {name: https, port: 8443, protocol: TCP, targetPort: 8080}
  - {name: http, port: 8080, protocol: TCP, targetPort: 8080}
  selector: {app: helloworld}
  type: NodePort
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: helloworld
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/tags: Environment=dev,Team=app**
spec:
  rules:
    - host: "*.amazonaws.com"
      http:
        paths:
          - path: /echo
            pathType: Prefix
            backend:
              service:
                name: helloworld
                port:
                  number: 8080

It has not created any loadbalancer. When I did kubectl get ingress , It showed me the ingress but it has no address. What am I doing wrong here?

your Ingress file seems to be correct,

for having ALB installed automatically from an Ingress you should install the AWS Load Balancer Controller which manages AWS Elastic Load Balancers for a Kube.netes cluster.

You can follow this and then verify that it is installed correctly:

kubectl get deployment -n kube-system aws-load-balancer-controller

apply:

kubectl apply -f service-ingress.yaml

and verify that your ALB, TG, etc are created:

kubectl logs deploy/aws-load-balancer-controller -n kube-system --follow

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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