Setup AWS Application Load Balancer Ingress in Kubernetes (Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys so in this video i'm going to explain how do you set up ingress in your kubernetes cluster using aws application load balancer if you're new to this channel please hit the subscribe button and like my video because it motivates me to make more such videos so the very first step is to create the cluster so for creating of the cluster i have a make file so this makefile has the eks cuttle commands which is eks cuttle create cluster minus f and this is the cluster file so the cluster file is quite simple i have just the cluster config and the name of the cluster is robin bursland cluster and it's in usb2 region it has two node groups which is of a type ec2 instance so i'll run make create cluster so this is going to run and create a cluster so it would take around 10 minutes for a cluster to be ready until our cluster is coming up let's look at the steps that are involved in a high level so the steps that are involved on setting up application load balancer ingresses first is we create the cluster and then we create a service account and an im provider so this links item roles to the service account so we need to enable that provider next is we create a cluster role which will be accessed by service account and then we create im policy and service account and then we have to deploy a aws alb ingress controller uh which will listen on to the ingress configuration and will enable aws load balancer corresponding droid and then ultimately we'll deploy our test application where we'll see the alb ingress let's quickly revise some of the basics of ingress and locate our demo application so english basics are suppose we have an application which is consists of three pods here and now when we want traffic to come to it we could configure a cluster ip service now we want external traffic to come to it we will have a node port type of a service which exposes a node port and then using route 53 we can map like 4.0. to the load balancer which could be an output service and then the key and then the traffic would be routed to the multiple pods and you could do the same for if you have another application with multiple parts right you could set up a load balancer using the note 4 servers and you can do like bar.jomo.click you could add configuration.53 and router traffic but we want all of this to be handled within the cluster itself and that's where uh ingress comes into picture so we so what we do is in route 53 will configure that all the traffic needs to go to the application load balancer and from application load balancer it's going to go to the ingress service which will then forward the traffic to food.jumo.click depending upon the url like all the host or bar.zoom.click depending on those so and this is all like all of these configurations is basically handled or like added in english.yaml file it could be any file name so that ingress configuration is listened to by ingress controller and that's what we'll deploy so we'll deploy aws ingress controller which would then process all of this configuration and would then by itself create an application load balancer and configure all of these listeners and all which would route the traffic to these various pods depending upon the the host and this is exactly what our application will be so we'll have a two set of applications one would be served by food or jomo.click and other application that would be served by bard.jumu.com so let's look at the application code that will deploy it's a very simple node server so it runs on port 3000 and it sees when the app the url is slash node app it's going to return like the response uh so it's going to say the process like so it says hello world from the host name which is the hostname of the pod and from the app so the app is configured based on the environment variable which is app name and if the url is not node app we return unknown path but we return status as 200. so for the deploying this app we can create two set of deployments like the first deployment is for the fu app and uh here we pass the app name as full because that app name will be used to serve the response this is where it will reply that it response is coming from the fu app and the bar is somewhat similar like we have the similar configuration we use the same image but the app name here is bar right so when the request would go to the full we'll come to know that the response is coming from from the fu app but the request when it goes to the bar will come to know that the response is coming for from the power app so this app is then connected by the service and the services often type node port so the traffic to this notepad service would be routed by our ingress so this is the ingress configuration so we add few annotations but would be which would be listed by aws ingress controller so we say that the ingress class is application load balancer alb and the scheme is internet facing because we want it to be internet facing scheme so here the target type for us since i'm setting up using like uh the nodes which i have set up for kubernetes are ec2 instances so for that's why i'll use in instance but you could use ip mode also if you are using fragrant type of nodes so here we have like uh the host if the traffic is coming from food or jumbo.click we want it to go to foods app service right and the full app service is here where we say like here is the full app service and fu app service then selects the fu app so the traffic will be routed to the full app and similarly if the host is bar.jumo.click we have the traffic going to bar dot app.service and then the bar uh the bar app service then forwards the traffic to the bar app so let's see if our uh cluster is up so the cluster is still building and let's wait for a few more minutes by the way if you're liking the video so far please subscribe to my channel and hit the like button because it motivates me a lot so our cluster is up now let's start the full process of setting up the ingress so first is enabling the service account and i am provider so all of this information is also available on this article so there is a couple of articles that you need to refer to it so this is the first one this is the other one so this if you see the heading is aws load balancer controller this explains everything which is needed to set up the controller that's the ingress controller that we were talking about and this is the one which explains about the ingress so i would say recommend like go through both of these in detail and these are the steps that will be following so the first one is enabling of aws plus i am provider and i have all of these commands written in the make file so the first is enable uh im provider which is eks utils soca associate im oidc provider so i say make so this enables the provider and next is we create the cluster role so this will be used by the service account which will create and again all of this code will be there in the description below so let's look at what is there in the role in which we created so this is basically a cluster role and then if you see we have a cluster role binding so what it does is it says that all of these epa groups these are the resources it says that what are the verbs that are allowed right so everything led to config maps endpoints ingress so it's mostly related to english stuff and all and written nodes and all it's mostly get list and watch right known spawn secrets now and the role binding if we see so the role binding is associated with a service account which will add which is aws alb ingress controller so let's go ahead and after we have created uh we need to create the aws im policy uh so you can download the policy from this location again the all of these links and all and this code like all of these commands would be in the description below i already have this policy so this would fail but i just created so it says like the policy already already exists and it already exists so that policy provides access to the service account and let's create the service account so make service account so this is creating im service account and our service account would be linked to the im role and that's why we had installed this associate i am odc provider so few things to notice like whatever account you use make sure you replace this account and also the cluster name right so these are the two things that you need to replace and the next thing we do is deploying of the cert manager so if you're exposing https routes and all creating of the certificates for your https uh traffic like all of those certification certificates are managed by the search manager and basically it downloads this file which is from that stack the search manager and install that so we say deploy sort manager and after that we'll deploy the ingress controller i've already downloaded the configurations for ingress controller so this tip which is on the second link which was for aws load balancer controller this explains the step how do you set up the ingress controller so the configurations is are available here and that's what i have download the couple of edits that you need to do because we already created the service account and they already mentioned very clearly here that you delete the service account on these lines which i've already dated in my cluster and then replace this your customer name which is online 797 uh and this what this what exactly i've done let me go to line number 797 so this is the cluster name and i've replaced it with my own cluster name right so let's deploy uh this aws uh load balancer controller this also contains uh like the controller which listens on to the english resources right now so let's say make deploy us controller and the next part that we have to do is deploying an application so again like the application we i've declared a customized file which is basically referring to all of these resources which we already saw which are two applications and then the ingress serving those so let's say make deploy application and you could just use cubecuttle instead of customized to me to keep things simple so this is my web console if i go to ec2 now and we see load balancer that's created let's click on the load balancer and it's in provisioning so it's getting created now so if you look at the listeners so let's look at the rules for this if we see rules so it's so it has already picked up the rules so the controller has picked up the rules which is if the host is food or two month click it needs to route the traffic to uh this listener if the this target group if the host is bar don't you want to click it needs the it needs to route the traffic to this target group if you look at this target group so it would be basically forwarding the traffic to both of those nodes wherever the wherever the pods are running and the status you see it's right now initializing so we'll have to like maybe wait for a couple of minutes for the load balancer and the target groups and all and the listeners to be up so other thing which is not handled by the load balancer controller is sending all the traffic to the application load balancer so i'll create a new record on route 53 for that so i say all the traffic which is star and i would declare the it to be areas so if i say choose an endpoint it should be uh application load balancer application and classic load balancers right and this is usb s2 and then my load balancer would appear here so i create here and then like for to keep it like i'll just uh set the evaluate target health as false just so that i don't have to wait for the health and all to be okay and the traffic is routed right away but you can turn it on so that's like the traffic just goes to the healthy uh target drops and all so if you look at our application load balancer the application load balancer is up and now let's try to hit the url which was four dot jump dot click slash node app this is the url which used to be served right so it says hello world and then the counter from app 4 and if we say bar and it says from app bar right so again link very old and all so it works fine so this is how easy it is to set up egress controller using application load balancer and route traffic to your pods or to your application so again all the code that i've used would be in the description below and if you have any questions if you are facing any issues let me know in the comments below and i hope i'll reply to your all all your questions and if you like this video please hit the subscribe button and like my video because it motivates me to keep making more such videos
Info
Channel: JOMO Developer
Views: 7,528
Rating: undefined out of 5
Keywords: kubernetes tutorial, kubernetes explained, kubernetes, kubernetes ingress, kubernetes ingress controller, kubernetes ingress controller nginx, eks kubernetes tutorial, eks kubernetes, eks kubernetes dashboard
Id: S8U7A-eGdOs
Channel Id: undefined
Length: 15min 1sec (901 seconds)
Published: Wed Jun 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.