AWS VPC - k8s - load balancing

后端 未结 3 1403
迷失自我
迷失自我 2020-12-22 10:26

Sorry for newbie question; I am new to the k8s world.The current way of deploying is to deploy the app on EC2. The new way I am trying to deploy the containerized app to VPC

3条回答
  •  感动是毒
    2020-12-22 11:00

    In general, you would have a AWS Load-balancer instance that would have multiple K8s workers as backend server with a specific port. After traffic entering worker nodes, networking inside K8s would take the job.

    Suppose you have setup two K8S services as load-balancer with port 38473 and 38474 for your two domains, respectively:

    xxx.yyy.com -> AWS LoadBalancer1 -> Node1:38473 -> K8s service1 -> K8s Pod1
                                     -> Node2:38473 -> K8s service1 -> K8s Pod2
    aaa.bbb.com -> AWS LoadBalancer2 -> Node1:38474 -> K8s service2 -> K8s Pod3
                                     -> Node2:38474 -> K8s service2 -> K8s Pod4
    

    This simple solution above would need to have you create different services as load-balancer, which would increase your cost because they are actual AWS load-balancer instances. To reduce cost, you could have an ingress-controller instance in your cluster and write ingress config. This would only require one actual AWS load-balancer to finish your networking:

    xxx.yyy.com -> AWS LoadBalancer1 -> Node1:38473 -> Ingress-service -> K8s service1 -> K8s Pod1
                                     -> Node2:38473 -> Ingress-service -> K8s service1 -> K8s Pod2
    aaa.bbb.com -> AWS LoadBalancer1 -> Node1:38473 -> Ingress-service -> K8s service2 -> K8s Pod3
                                     -> Node2:38473 -> Ingress-service -> K8s service2 -> K8s Pod4
    

    For more information, you could refer more information here:

    • Basic Networking and K8s Services: https://kubernetes.io/docs/concepts/services-networking/service/
    • Ingress & ingress controller (Nginx Implementation): https://www.nginx.com/products/nginx/kubernetes-ingress-controller

提交回复
热议问题