How to Create EKS Cluster Using Terraform + IAM Roles for Service Accounts & EKS Cluster Autoscaler

  Рет қаралды 66,198

Anton Putra

Anton Putra

Күн бұрын

Пікірлер: 132
@AntonPutra
@AntonPutra Жыл бұрын
🔴 - To support my channel, I’d like to offer Mentorship/On-the-Job Support/Consulting - me@antonputra.com 👉 [UPDATED] AWS EKS Kubernetes Tutorial [NEW]: kzbin.info/aero/PLiMWaCMwGJXnKY6XmeifEpjIfkWRo9v2l&si=wc6LIC5V2tD-Tzwl
@AntonPutra
@AntonPutra 3 жыл бұрын
🔴UPDATED🔴 How to create EKS Cluster using Terraform MODULES (AWS Load Balancer Controller + Autoscaler + IRSA) - kzbin.info/www/bejne/oYOunpaPeJxkgJY Monitor EKS & EC2 instances with MANAGED Prometheus - kzbin.info/www/bejne/Y5-4goF8dr1oiqs Native EKS Ingress: AWS Load Balancer Controller - kzbin.info/www/bejne/g4vco6uwl5ysd7c How to Add IAM User and IAM Role to AWS EKS Cluster? - kzbin.info/www/bejne/e3jHf2Vne5d9nNk How to Create EKS Cluster Using eksctl? - kzbin.info/www/bejne/a2fFmJ2qfLqtfac
@AntonPutra
@AntonPutra Жыл бұрын
🟢 [New] Terragrunt Tutorial: Create VPC, EKS from Scratch! (Step-by-Step) - kzbin.info/www/bejne/r5XYeZSFn5iLg8k
@AntonPutra
@AntonPutra Жыл бұрын
👉 How to Manage Secrets in Terraform - kzbin.info/www/bejne/aX-TpXqBrNt1mqM 👉 Terraform Tips & Tricks - kzbin.info/www/bejne/bYScZaKLid5lsJY 👉 ArgoCD Tutorial - kzbin.info/www/bejne/sHjRlZqafMZkisU
@AntonPutra
@AntonPutra Жыл бұрын
Get Full-Length High-Quality DevOps Tutorials for Free - Subscribe Now! - kzbin.info
@roshankeram7460
@roshankeram7460 Жыл бұрын
I am not able to find github link for above project I found it for modules one
@craigrodrigues3435
@craigrodrigues3435 2 жыл бұрын
Excellent! In my opinion, using terraform to create EKS clusters is better than depending on CloudFormation or eksctl
@AntonPutra
@AntonPutra 2 жыл бұрын
agree
@TigranAndonian
@TigranAndonian Жыл бұрын
Anton, very good, one of the best explanation I saw! Thank you!
@13bhanuprakash
@13bhanuprakash 2 жыл бұрын
Excellent Start to EKS via Terraform -- Many Thanks for this ....
@AntonPutra
@AntonPutra 2 жыл бұрын
You're very welcome!
@MrEdinaldolaroque
@MrEdinaldolaroque 2 жыл бұрын
спасибо большое, Антон Путра! Thank you for sharing your knowledge!
@AntonPutra
@AntonPutra 2 жыл бұрын
welcome =)
@AbdullaJandali
@AbdullaJandali 9 ай бұрын
amazing tutorial, i encountered issue with the route table syntax tho had to troubleshoot it for few hours , i ended up using a different module , but other than that, its working smooth , thanks a lot
@pikaa-si9ie
@pikaa-si9ie 9 ай бұрын
Do u mind providing source code that?
@zhilin6068
@zhilin6068 2 жыл бұрын
simple but very clear, like this course
@AntonPutra
@AntonPutra 2 жыл бұрын
Glad to hear that!
@rehantayyab82
@rehantayyab82 Жыл бұрын
this is first video in series , should'nt it be gradually go from basic towards advanced .....great work indeed
@AntonPutra
@AntonPutra Жыл бұрын
Thank you! I've created so many tutorials about EKS that I don't even remember what's in them, lol.
@VinothRajkumar
@VinothRajkumar Жыл бұрын
Excellent video. Keep rocking with more videos
@AntonPutra
@AntonPutra Жыл бұрын
Thanks!
@nckillada8839
@nckillada8839 2 жыл бұрын
Awesome! Well explained, thanks!!
@AntonPutra
@AntonPutra 2 жыл бұрын
You're welcome!
@davystrain7217
@davystrain7217 10 ай бұрын
brilliant workshop well done and thank you :)
@israel8707
@israel8707 2 жыл бұрын
@Anton Putra thanks very much for shared this amazing tutorial, I did it complete step by step and only I did small changes, but everithing is work ok, thanks again :)
@AntonPutra
@AntonPutra 2 жыл бұрын
welcome!
@zakariamansouri351
@zakariamansouri351 Жыл бұрын
thank you so much Anton for providing such a content , subscribed 👌
@AntonPutra
@AntonPutra Жыл бұрын
My plreasure!
@unixbashscript9586
@unixbashscript9586 3 жыл бұрын
Excellent stuff!
@AntonPutra
@AntonPutra 3 жыл бұрын
Glad you liked it!
@viniciuscordeiro1360
@viniciuscordeiro1360 Жыл бұрын
thank you very much!
@AntonPutra
@AntonPutra Жыл бұрын
Welcome!
@brahmaiahboddu5762
@brahmaiahboddu5762 3 жыл бұрын
Super👍
@AntonPutra
@AntonPutra 3 жыл бұрын
Thank you 👍
@albertoporras3341
@albertoporras3341 2 жыл бұрын
Great video, learning a lot. Thanks a lot 5 stars video.
@AntonPutra
@AntonPutra 2 жыл бұрын
Thanks Alberto!
@albertoporras3341
@albertoporras3341 2 жыл бұрын
@@AntonPutra Quick question! how I can SSH to EKS Worker Nodes, which variables I need to add and if I need to add it to 7-nodes.tf or in 0-provider.tf file?
@Randych
@Randych Жыл бұрын
@@albertoporras3341 out of curiosity, WHY on earth would you do that
@david2358
@david2358 2 жыл бұрын
Thank you, learned a lot and subscribed!! 👍
@AntonPutra
@AntonPutra 2 жыл бұрын
Welcome aboard! :)
@christianibiri
@christianibiri 3 жыл бұрын
Great video!!!
@AntonPutra
@AntonPutra 3 жыл бұрын
Thank you!!
@675FresH
@675FresH Жыл бұрын
Спасибо большое за гайд, очень помогло!
@AntonPutra
@AntonPutra Жыл бұрын
pojaluysta =)
@Whitegatellc1
@Whitegatellc1 2 жыл бұрын
Great Video Anton! For-Self Managed K8S clusters using EKS but using " worker-groups" as worker nodes with Auto-Scaling, will the same policies you attached to your IAM role be the same? Looking forward to more great stuff from you!
@AntonPutra
@AntonPutra 2 жыл бұрын
Thanks Abimbola! I haven't tested, but should be the same.
@yusranad
@yusranad 3 жыл бұрын
Awesome video. I have been automated my deployment EKS using terraform since I watch your video it make me to practice it. I have question is the terraform can execute a script since I'm using rancher inside the kubernetes for manage my Kubernetes using EKS.
@AntonPutra
@AntonPutra 3 жыл бұрын
Thanks, yes terraform can execute local script and/or remote script. Frequently it is used with configuration management tools such as Ansible, Puppet, etc. Here is a reference www.terraform.io/language/resources/provisioners/local-exec www.terraform.io/language/resources/provisioners/remote-exec
@felipealvarez1982
@felipealvarez1982 2 жыл бұрын
thanks for uploading the video. I found the instructions to be a little too quick, and pasting some of the code examples were hard to follow because they were too large/long, and the video pace was a bit quick.
@AntonPutra
@AntonPutra 2 жыл бұрын
Thanks for the feedback, you can find the source code in the github repo
@MB982010
@MB982010 2 жыл бұрын
Hey Anton, thanks for this video it is awsome! Could you please do another one withTerraform but with ArgoCD included? Thanks again.
@AntonPutra
@AntonPutra 2 жыл бұрын
Sure!
@mehmetnuricetin4104
@mehmetnuricetin4104 Жыл бұрын
Thanks Anton for great video. I try to create CI-CD pipeline for github action. There is some code exemple that I can use?
@AntonPutra
@AntonPutra Жыл бұрын
Sure, 1. GitHub Actions Self Hosted Runner (Autoscaling with Kubernetes) 2. How to Create Your Own GitHub Actions? kzbin.info/www/bejne/oKjHeGl6YqZ1Z80 3. Build a Docker Image and Publish It to GCP GCR & Artifact Registry using Github Actions - kzbin.info/www/bejne/bJWveZakobWclbc 4. Build a Docker Image and Publish It to AWS ECR using Github Actions kzbin.info/www/bejne/fqeYhpZ4jtiYq9U
@mehmetnuricetin4104
@mehmetnuricetin4104 Жыл бұрын
And I am really junior :) I mean also if there is some repository for using terraform to create github action for eks! Thanks again
@rehantayyab82
@rehantayyab82 Жыл бұрын
u did not tell about vpcendpoint which are required when we deploy app on nodegroup in private subnets and some security group settings as well , please can you clarify on this ?
@AntonPutra
@AntonPutra Жыл бұрын
Security Group is managed by the EKS, not sure what do you mean.. You can expose app using private or public service of type load balancer.
@amittaywade8753
@amittaywade8753 2 жыл бұрын
Nice video and explaination, I have tried everything. JFYI cluster-autoscaler.yaml code is missing in your DOC
@AntonPutra
@AntonPutra 2 жыл бұрын
Thanks
@nforlife
@nforlife 2 жыл бұрын
Great video as usual Anton. could you add HPA ?
@AntonPutra
@AntonPutra 2 жыл бұрын
Thanks, I already have 2 Horizontal Pod Autoscaler CUSTOM METRICS & PROMETHEUS - kzbin.info/www/bejne/n6DHomBqqNeLd5o Kubernetes Horizontal Pod Autoscaler - kzbin.info/www/bejne/pnrCoYCpqsatp9k
@supreethashetty7493
@supreethashetty7493 Жыл бұрын
Could please show create eks node using launch template
@AntonPutra
@AntonPutra Жыл бұрын
Sure, here - github.com/antonputra/tutorials/blob/b09834856cc27ad8aa2fde45fbcd655a9a1425dd/lessons/150/terraform/7-nodes.tf#L129-L139
@lawrenceobrero4228
@lawrenceobrero4228 2 жыл бұрын
Great tutorial! Thanks for the video. I'm curious why there is no security groups in the terraform files?
@AntonPutra
@AntonPutra 2 жыл бұрын
Thanks, as far as I remember EKS will generate them for you.
@ajadavis2000
@ajadavis2000 2 жыл бұрын
hello! thank u v much this is v informational. was wondering how to limit public network access through inbound rules/security groups like an ec2 - currently the loadbalancer is accessible anywhere
@AntonPutra
@AntonPutra 2 жыл бұрын
It depends on the load balancer. Network load balancer does not have security groups and inherit rules from ec2 instances. Application load balancer needs it's own security group. If you can explain your use case i can give more specific recommendation.
@ajadavis2000
@ajadavis2000 2 жыл бұрын
@@AntonPutra thanks so much for getting back. so i use the hasura graphql engine in a container, and if i deploy with a load balancer, i can reach the UI via a call to the dns. The graphql also has to be accessible to rds and an app in cloudfront. so it appears that maybe the ec2 security group is best to manage public accessibility of the hasura UI, and an application load balancer is the best solution to manager the graphql engine and its connections to the rds and cloudfront application - does this sound right?
@mantikoragio6555
@mantikoragio6555 Жыл бұрын
Thanks a lot! Could you tell how you made VS Code folder icons prettier & what's the terminal Theme? Looks beautiful! :)
@AntonPutra
@AntonPutra Жыл бұрын
I believe I used "this extension - marketplace.visualstudio.com/items?itemName=vscode-icons-team.vscode-icons. For the terminal it's item2 + ohmyz.sh/
@kossei8096
@kossei8096 4 ай бұрын
How do you pass aws credential to the pod? Because i get an error "unable to locate credential. You can configure credentials by running aws configure"
@kossei8096
@kossei8096 4 ай бұрын
Turns out i just miss indentation 😅
@AntonPutra
@AntonPutra 4 ай бұрын
@@kossei8096 ok :)
@leo5946
@leo5946 2 жыл бұрын
do we need to create an iam role demo explicitly ? u did not create one in the video, or do you have one already ?
@AntonPutra
@AntonPutra 2 жыл бұрын
It's in the terraform code. Yes, you need 1 role for control plane and another one for node pool.
@ariskaraiskos8079
@ariskaraiskos8079 2 жыл бұрын
Hi Anton, great video mate, may i ask, can we set up autoscaler to scale automatically based on the load? and if yes, how? thanks!
@AntonPutra
@AntonPutra 2 жыл бұрын
Sure, i have few tutorials on my channel how to scale based on cpu & memory as well as custom metrics defined using prometheus
@andreykaparulin9214
@andreykaparulin9214 3 жыл бұрын
Thanks
@AntonPutra
@AntonPutra 3 жыл бұрын
Welcome
@vimaladeshmukh4017
@vimaladeshmukh4017 2 жыл бұрын
Hey awesome video sir.. one request, u havent attached service account,cluster role and binding related to autoscaler group in the link you provided. Could you please add that in your notes.🙏 Whole cluster-autoscaler.yaml file is missing in the given link.
@AntonPutra
@AntonPutra 2 жыл бұрын
this one? github.com/antonputra/tutorials/blob/main/lessons/102/k8s/cluster-autoscaler.yaml
@kiranshelke1627
@kiranshelke1627 2 жыл бұрын
Nice video Anton. Could you please share terraform script using EKS fargate?
@AntonPutra
@AntonPutra 2 жыл бұрын
Thanks, here - github.com/antonputra/tutorials/tree/main/lessons/102
@rellimcire
@rellimcire Жыл бұрын
Your videos have helped me a lot. However, I'm still confused about load balancing. Somehow your cluster knows to create a load balancer when you create a LoadBalancer service. My cluster does not do that. Is there some setting or policy I need to add somewhere to make that work?
@AntonPutra
@AntonPutra Жыл бұрын
Kubernetes project have intree controllers that responsible for creating load balancers in different supported clouds. If you on premise or even bare metal try to install metallb. Otherwise just kubectl describe svc to get error message
@rellimcire
@rellimcire Жыл бұрын
@@AntonPutra I'm in EKS. But your reply helped a lot. I'm tracing error now.
@shulyakav
@shulyakav 3 жыл бұрын
Скажи, а у тебя было время посмотреть в сторону Karpenter? я вот глянул, крутая штука, вроде бы.
@AntonPutra
@AntonPutra 3 жыл бұрын
Poka net, sdelay video pro karpenter navernoe cherez nedelyu.
@crimson27271
@crimson27271 Жыл бұрын
does the code for the autoscaler need to be updated? the pod keeps crashing for me, at firts i though it was the amount of memory but after raising it it keeps crashing and the logs are way to many to make sense, when i use describe pod i just get Back-off restarting failed container
@AntonPutra
@AntonPutra Жыл бұрын
make sure you match autoscaler version to your k8s as close as possible
@crimson27271
@crimson27271 Жыл бұрын
@@AntonPutra I change the image version to 1.22.1 but still gave me problems, then i notice that the problem was that i did not change the account number on my rol, and after doing the change seens to be running just fine.
@AntonPutra
@AntonPutra Жыл бұрын
@@crimson27271 good to know, need to put a warning there =)
@arindamghosh3299
@arindamghosh3299 2 жыл бұрын
How do you tackle the situation when the cluster autoscaler has changed the cluster scaling from 1 to 2 (and terraform won't know this) and then you need to perform a terraform deployment? In that case the scaling config will show the desired size of the cluster node has been changed and will try to put it back to 1, isn't it?
@AntonPutra
@AntonPutra 2 жыл бұрын
It should not happen. How do you manage your node pool? (managed, unmanaged, or separate autoscaling group)
@david2358
@david2358 2 жыл бұрын
Quick question: why didn't you also add add-ons in your eks.tf file? Will the cluster work without add-ons?
@AntonPutra
@AntonPutra 2 жыл бұрын
It will work with and without adonds. Do you have any specific addon in mind?
@aryadiadi6888
@aryadiadi6888 2 жыл бұрын
@@AntonPutra EFS
@Randych
@Randych Жыл бұрын
@@aryadiadi6888 ew fargate
@jinkahari
@jinkahari 2 жыл бұрын
Hi Anton, I am getting errror " │ Inappropriate value for attribute "route": element 0: attribute "core_network_arn" is required." in route tables creation.
@AntonPutra
@AntonPutra 2 жыл бұрын
if i get the same error will provide a feedback
@fenilshah7310
@fenilshah7310 Жыл бұрын
What if I don't want to use elastic IP? Is there another way to configure this?
@AntonPutra
@AntonPutra Жыл бұрын
elastic ip for what? nat? well use public subnets with igw
@rritsoftwaresolutions9566
@rritsoftwaresolutions9566 Жыл бұрын
super all the best keep it up , i like yours video , great super amazing video , PLEASE DO MAKING SAME REAL TIME EKS CLUSTER VIDEOS , i appreciate you /////
@George-mk7lp
@George-mk7lp 2 жыл бұрын
what terraform version did you use in this tutorial?
@AntonPutra
@AntonPutra 2 жыл бұрын
I don't remember the exact version but higher 1.1.x. Next time will commit terraform lock file.
@james-mo2pk
@james-mo2pk 2 жыл бұрын
Why did you use only one nat gateway in this section?
@AntonPutra
@AntonPutra 2 жыл бұрын
Well, the general recommendation by AWS to use nat gateway per availability zone. But for the last five years, I have never had issues with nat gateways. It's cost vs. ha balance that you need to decide for yourself. AWS will always try to convince you to use multi az and multi-region :)
@james-mo2pk
@james-mo2pk 2 жыл бұрын
Thank you for the good video and kind reply😁
@nulops
@nulops 2 жыл бұрын
Do you implement vpc_cni ?
@AntonPutra
@AntonPutra 2 жыл бұрын
Yes, EKS supports native VPC networking (via CNI plugin)
@miv_cleric
@miv_cleric Жыл бұрын
How do I test the private load balancer?
@AntonPutra
@AntonPutra Жыл бұрын
Test? You can open it in AWS console and find scheme property.
@rajenthapa4178
@rajenthapa4178 2 жыл бұрын
Thank you very much for the video Anton. It was really awesome and helpful. How can we setup the aws load balancer controller for eks ingress via Terraform?
@AntonPutra
@AntonPutra 2 жыл бұрын
Thanks, I usually configure only AWS staff using terraform such as IAM permissions for controller. Deployment itself (YAML) is managed by other tools such as flux. You could however to use Terraform Kubernetes Provider - registry.terraform.io/providers/hashicorp/kubernetes/latest/docs
@JP-qx6tw
@JP-qx6tw 3 жыл бұрын
Hi Anton, If we deploy an ALB how can we reuse the ALB for other services/ingress?
@AntonPutra
@AntonPutra 3 жыл бұрын
There is a way with AWS Load Balancer Controller.You need to create TargetGroupBinding. It is a custom resource (CR) that can expose your pods using an existing ALB TargetGroup or NLB TargetGroup. I'm. going to create tutorial soon, here is a link for official doc - kubernetes-sigs.github.io/aws-load-balancer-controller/v2.3/guide/targetgroupbinding/targetgroupbinding/
@mum0l57
@mum0l57 2 жыл бұрын
Very nice, but you could speak more slowly.. ;)
@AntonPutra
@AntonPutra 2 жыл бұрын
Thank, noted!
@qizhang5749
@qizhang5749 2 жыл бұрын
Lol had to check my playback speed
@sobankhan7517
@sobankhan7517 Жыл бұрын
SIr thanks
@AntonPutra
@AntonPutra Жыл бұрын
welcome!
@George-mk7lp
@George-mk7lp 2 жыл бұрын
Why do we use cluster autoscaler as deployment if we already have node autoscaling in the nodes.tf file ? I mean this one: resource "aws_eks_node_group" "private-nodes" { cluster_name = aws_eks_cluster.demo.name node_group_name = "private-nodes" node_role_arn = aws_iam_role.nodes.arn subnet_ids = [ aws_subnet.private-us-east-1a.id, aws_subnet.private-us-east-1b.id ] capacity_type = "ON_DEMAND" instance_types = ["t3.small"] scaling_config { desired_size = 2 max_size = 5 min_size = 2 } update_config { max_unavailable = 1 }
@AntonPutra
@AntonPutra 2 жыл бұрын
Autoscaling block in terraform only configures AWS autoscaling group with min, max and desired size. Job of autoscaler deployed in K8s is to adjust desired size based on the load.
@Randych
@Randych Жыл бұрын
I don't understand: - why public subnets are REQUIRED - why are you forced to connect private subnets to internet - why do you use private LB if it's same as public LB since private subnets are connected to internet
@AntonPutra
@AntonPutra Жыл бұрын
- only if you want to expose your apps to internet - typically we have 3 types of subnets: 1. public with internet gateway 2. private with nat gateway 3. isolated without access to internet, usually used for databases - it's not the same. Private LB only accessible within VPC, public LBs accessible from the internet
@Randych
@Randych Жыл бұрын
@@AntonPutra oh right, DB subnets, thanks for reminder, I'll go over it. Also your tutorial is shallow on launch template topic. You do know that slightest wrong in mandatory user data results in "instances failed to join cluster" yet you skipped it. Why user data? How about 99 max pods on t3.small?
@suganthselvan
@suganthselvan Жыл бұрын
Good content, but too fast making it less effective
@pravinkhot8626
@pravinkhot8626 Жыл бұрын
Very fast
@AntonPutra
@AntonPutra Жыл бұрын
noted
@cryptographbd1176
@cryptographbd1176 2 жыл бұрын
Hi sir, This is really helpfull videos for me, I faces some issues here on route.tf file, when I press terraform apply then its shows this issues- 1. Error: Incorrect attribute value type │ │ on routes.tf line 4, in resource "aws_route_table" "private": │ 4: route = [ │ 5: { │ 6: cidr_block = "0.0.0.0/0" │ 7: nat_gateway_id = aws_nat_gateway.nat.id │ 8: carrier_gateway_id = "" 2. Inappropriate value for attribute "route": element 0: attribute "core_network_arn" is required 3. Error: Incorrect attribute value type │ │ on routes.tf line 30, in resource "aws_route_table" "public": │ 30: route = [ │ 31: { │ 32: cidr_block = "0.0.0.0/0" │ 33: gateway_id = aws_internet_gateway.igw.id │ 34: nat_gateway_id = "" │ 35: carrier_gateway_id = "" help me to solve this issues.
@Randych
@Randych Жыл бұрын
Why? Because.
Terragrunt Tutorial: Create VPC, EKS from Scratch!
1:01:09
Anton Putra
Рет қаралды 49 М.
Getting Started with EKS and Terraform
18:51
That DevOps Guy
Рет қаралды 41 М.
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
Create EKS Cluster with Terraform EKS Blueprints
22:39
Anton Putra
Рет қаралды 14 М.
AWS EKS - Create Kubernetes cluster on Amazon EKS | the easy way
16:27
TechWorld with Nana
Рет қаралды 566 М.
Crazy fast Kubernetes Automation with Terraform
26:23
Christian Lempa
Рет қаралды 103 М.