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

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

Комментарии • 132

  • @AntonPutra
    @AntonPutra  Год назад +6

    🔴 - To support my channel, I’d like to offer Mentorship/On-the-Job Support/Consulting - me@antonputra.com
    👉 [UPDATED] AWS EKS Kubernetes Tutorial [NEW]: ruclips.net/p/PLiMWaCMwGJXnKY6XmeifEpjIfkWRo9v2l&si=wc6LIC5V2tD-Tzwl

  • @craigrodrigues3435
    @craigrodrigues3435 2 года назад +9

    Excellent! In my opinion, using terraform to create EKS clusters is better than depending on CloudFormation or eksctl

  • @rehantayyab82
    @rehantayyab82 Год назад +1

    this is first video in series , should'nt it be gradually go from basic towards advanced .....great work indeed

    • @AntonPutra
      @AntonPutra  Год назад +1

      Thank you! I've created so many tutorials about EKS that I don't even remember what's in them, lol.

  • @AntonPutra
    @AntonPutra  Год назад +5

    👉 How to Manage Secrets in Terraform - ruclips.net/video/3N0tGKwvBdA/видео.html
    👉 Terraform Tips & Tricks - ruclips.net/video/7S94oUTy2z4/видео.html
    👉 ArgoCD Tutorial - ruclips.net/video/zGndgdGa1Tc/видео.html

  • @TigranAndonian
    @TigranAndonian Год назад +1

    Anton, very good, one of the best explanation I saw! Thank you!

  • @AbdullaJandali
    @AbdullaJandali 8 месяцев назад

    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 8 месяцев назад

      Do u mind providing source code that?

  • @13bhanuprakash
    @13bhanuprakash 2 года назад +1

    Excellent Start to EKS via Terraform -- Many Thanks for this ....

  • @MrEdinaldolaroque
    @MrEdinaldolaroque 2 года назад +2

    спасибо большое, Антон Путра! Thank you for sharing your knowledge!

  • @AntonPutra
    @AntonPutra  Год назад +1

    🟢 [New] Terragrunt Tutorial: Create VPC, EKS from Scratch! (Step-by-Step) - ruclips.net/video/yduHaOj3XMg/видео.html

  • @zhilin6068
    @zhilin6068 2 года назад +1

    simple but very clear, like this course

  • @AntonPutra
    @AntonPutra  2 года назад +4

    🔴UPDATED🔴 How to create EKS Cluster using Terraform MODULES (AWS Load Balancer Controller + Autoscaler + IRSA) - ruclips.net/video/kRKmcYC71J4/видео.html
    Monitor EKS & EC2 instances with MANAGED Prometheus - ruclips.net/video/-nUQNFAX5TI/видео.html
    Native EKS Ingress: AWS Load Balancer Controller - ruclips.net/video/MZyrxzb7yAU/видео.html
    How to Add IAM User and IAM Role to AWS EKS Cluster? - ruclips.net/video/EGdN21F2Jfw/видео.html
    How to Create EKS Cluster Using eksctl? - ruclips.net/video/56bgjtGUzGE/видео.html

  • @AntonPutra
    @AntonPutra  Год назад +1

    Get Full-Length High-Quality DevOps Tutorials for Free - Subscribe Now! - ruclips.net/user/AntonPutra

    • @roshankeram7460
      @roshankeram7460 Год назад

      I am not able to find github link for above project I found it for modules one

  • @israel8707
    @israel8707 2 года назад +1

    @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 :)

  • @davystrain7217
    @davystrain7217 9 месяцев назад

    brilliant workshop well done and thank you :)

  • @VinothRajkumar
    @VinothRajkumar Год назад +1

    Excellent video. Keep rocking with more videos

  • @zakariamansouri351
    @zakariamansouri351 Год назад +1

    thank you so much Anton for providing such a content , subscribed 👌

  • @nckillada8839
    @nckillada8839 2 года назад +2

    Awesome! Well explained, thanks!!

  • @albertoporras3341
    @albertoporras3341 2 года назад +1

    Great video, learning a lot. Thanks a lot 5 stars video.

    • @AntonPutra
      @AntonPutra  2 года назад +1

      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

  • @675FresH
    @675FresH Год назад +1

    Спасибо большое за гайд, очень помогло!

  • @viniciuscordeiro1360
    @viniciuscordeiro1360 Год назад +1

    thank you very much!

  • @david2358
    @david2358 2 года назад +1

    Thank you, learned a lot and subscribed!! 👍

  • @brahmaiahboddu5762
    @brahmaiahboddu5762 2 года назад +2

    Super👍

  • @felipealvarez1982
    @felipealvarez1982 2 года назад +1

    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

  • @unixbashscript9586
    @unixbashscript9586 2 года назад +1

    Excellent stuff!

  • @MB982010
    @MB982010 2 года назад +2

    Hey Anton, thanks for this video it is awsome!
    Could you please do another one withTerraform but with ArgoCD included?
    Thanks again.

  • @christianibiri
    @christianibiri 2 года назад +1

    Great video!!!

  • @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 /////

  • @Whitegatellc1
    @Whitegatellc1 2 года назад +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 года назад +1

      Thanks Abimbola! I haven't tested, but should be the same.

  • @amittaywade8753
    @amittaywade8753 Год назад +1

    Nice video and explaination, I have tried everything. JFYI cluster-autoscaler.yaml code is missing in your DOC

  • @andreykaparulin9214
    @andreykaparulin9214 2 года назад +1

    Thanks

  • @supreethashetty7493
    @supreethashetty7493 Год назад +1

    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

  • @mehmetnuricetin4104
    @mehmetnuricetin4104 Год назад +1

    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  Год назад +1

      Sure,
      1. GitHub Actions Self Hosted Runner (Autoscaling with Kubernetes)
      2. How to Create Your Own GitHub Actions? ruclips.net/video/jwdG6D-AB1k/видео.html
      3. Build a Docker Image and Publish It to GCP GCR & Artifact Registry using Github Actions - ruclips.net/video/6dLHcnlPi_U/видео.html
      4. Build a Docker Image and Publish It to AWS ECR using Github Actions ruclips.net/video/Hv5UcBYseus/видео.html

    • @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.

  • @nforlife
    @nforlife 2 года назад +1

    Great video as usual Anton. could you add HPA ?

    • @AntonPutra
      @AntonPutra  2 года назад +1

      Thanks, I already have 2
      Horizontal Pod Autoscaler CUSTOM METRICS & PROMETHEUS - ruclips.net/video/iodq-4srXA8/видео.html
      Kubernetes Horizontal Pod Autoscaler - ruclips.net/video/pI_pMsuazqw/видео.html

  • @yusranad
    @yusranad 2 года назад +1

    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  2 года назад

      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

  • @kossei8096
    @kossei8096 3 месяца назад

    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 3 месяца назад

      Turns out i just miss indentation 😅

    • @AntonPutra
      @AntonPutra  3 месяца назад

      @@kossei8096 ok :)

  • @sobankhan7517
    @sobankhan7517 Год назад +1

    SIr thanks

  • @lawrenceobrero4228
    @lawrenceobrero4228 2 года назад +1

    Great tutorial! Thanks for the video. I'm curious why there is no security groups in the terraform files?

    • @AntonPutra
      @AntonPutra  2 года назад +2

      Thanks, as far as I remember EKS will generate them for you.

  • @kiranshelke1627
    @kiranshelke1627 2 года назад +1

    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

  • @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?

  • @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

  • @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  Год назад +2

      I believe I used "this extension - marketplace.visualstudio.com/items?itemName=vscode-icons-team.vscode-icons.
      For the terminal it's item2 + ohmyz.sh/

  • @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

  • @mum0l57
    @mum0l57 2 года назад +3

    Very nice, but you could speak more slowly.. ;)

  • @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

  • @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

  • @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)

  • @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  Год назад +1

      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.

  • @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.

  • @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  Год назад +1

      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  Год назад +1

      @@crimson27271 good to know, need to put a warning there =)

  • @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.

  • @shulyakav
    @shulyakav 2 года назад

    Скажи, а у тебя было время посмотреть в сторону Karpenter? я вот глянул, крутая штука, вроде бы.

    • @AntonPutra
      @AntonPutra  2 года назад +1

      Poka net, sdelay video pro karpenter navernoe cherez nedelyu.

  • @rajenthapa4178
    @rajenthapa4178 2 года назад +1

    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 года назад +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

  • @nulops
    @nulops 2 года назад

    Do you implement vpc_cni ?

    • @AntonPutra
      @AntonPutra  2 года назад +1

      Yes, EKS supports native VPC networking (via CNI plugin)

  • @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 года назад +1

      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

  • @George-mk7lp
    @George-mk7lp 2 года назад

    what terraform version did you use in this tutorial?

    • @AntonPutra
      @AntonPutra  2 года назад +2

      I don't remember the exact version but higher 1.1.x. Next time will commit terraform lock file.

  • @JP-qx6tw
    @JP-qx6tw 2 года назад +1

    Hi Anton,
    If we deploy an ALB how can we reuse the ALB for other services/ingress?

    • @AntonPutra
      @AntonPutra  2 года назад +1

      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/

  • @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 года назад +3

      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.

  • @james-mo2pk
    @james-mo2pk 2 года назад

    Why did you use only one nat gateway in this section?

    • @AntonPutra
      @AntonPutra  2 года назад +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😁

  • @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

  • @cryptographbd1176
    @cryptographbd1176 2 года назад +1

    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.