Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Terraform ❤️ Vungle

Terraform ❤️ Vungle

Provision & Manage Kubernetes Clusters with Terraform

Tommy Nguyen

March 22, 2021
Tweet

More Decks by Tommy Nguyen

Other Decks in Technology

Transcript

  1. Agenda - Vungle Introduction - Infrastructure Overview - IaC -

    Terraform 101 - Terraform @ Vungle - Cluster Prerequisites - Cluster Provisioning - Demo - Q & A - Conclusion
  2. We Are Vungle Performance Ad Network Vungle directly connects premium

    global advertisers Advertisers Acquire high quality users with high performance outcomes (installs) Publishers Supply inventory of users with high performance revenue with publishers ad inventory – across brands and gaming audiences
  3. / 5 San Francisco London Berlin Singapore Beijing Seoul Tokyo

    87% out of the top 100 apps have seen success with Vungle 60K total apps trust Vungle to monetize their apps 2B unique devices experience high-quality Vungle ads every month 150+ countries experience Vungle ads every day New York
  4. Robust Data Vungle has always been at the forefront of

    performance advertising, setting industry standards since the first smartphones came to market. Today, Vungle touches a third of all smartphones on the planet and serves 5 billion ads every month.
  5. ...

  6. The Benefit of Adapting IaC - Faster speed and consistency

    - Efficient software development lifecycle - Reduced operation overhead
  7. CODE EDITOR . ├── README.md ├── infra │ ├── secrets

    │ └── terraform ├── ops │ ├── helm │ ├── terraform │ └── ... ├── pull_request_template.md └── src ├── mongo-exporter ├── redis-exporter ├── lib ├── metrics-explorer └── ...
  8. What is it? - Terraform codifies cloud APIs into declarative

    configuration files. - Same configuration language to work with all cloud providers.
  9. Code Editor # main.tf resource "aws_instance" "web" { ami =

    "ami-005e54dee72cc1d00" instance_type = "t3.micro" tags = { Name = "HelloWorld" } }
  10. Terminal $ terraform apply An execution plan has been generated

    and is shown below. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: + aws_instance.web id: <computed> ami: "ami-032fb460" # ... aws_instance.web: Creating... ami: "" => "ami-032fb460" associate_public_ip_address: "" => "<computed>" # … aws_instance.web: Still creating... (10s elapsed) aws_instance.web: Still creating... (20s elapsed) aws_instance.web: Creation complete after 21s (ID: i-062e80b6d9f079a17) Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
  11. Other Providers - Not just AWS / GCP, Terraform also

    supports the wide range of providers - Infrastructure - Content Delivery Network - Monitoring
  12. Naming Convention - Make sure that related resources have related

    name / tag - Easier to do cost management - Easier to clean up - Easier to audit
  13. Overview - Amazon EKS is the hosted Kubernetes solution in

    Amazon Web Services - EKS makes it easy to standardize operations across every environment
  14. Terminal $ eksctl create cluster --name my-cluster \ --region us-west-2

    --with-oidc \ --ssh-access --ssh-public-key <your-key> --managed $ eksctl create cluster -f cluster.yaml ``` apiVersion: eksctl.io/v1alpha5 kind: ClusterConfig metadata: name: basic-cluster region: eu-north-1 nodeGroups: - name: ng-1 instanceType: m5.large desiredCapacity: 10 - name: ng-2 instanceType: m5.xlarge desiredCapacity: 2 ```
  15. Code Editor module "eks" { source = "../../modules/eks" namespace =

    "eks" environment = "stage" name = "1a" region = "us-east-1" vpc_id = data.aws_vpc.self.vpc_id vpc_cidr = data.aws_vpc.self.vpc_id public_subnets = { "eks-stage-1a-public-1" = { cidr_block = "10.x.x.x/24" availability_zone = "us-east-1a" tag_enabled = true }, } private_subnets = { "eks-stage-1a-private-1" = { cidr_block = "10.x.x.x/24" availability_zone = "us-east-1a" nat_to = "eks-stage-1a-public-1" }, } }
  16. Terminal λ eks % tree . ├── README.md ├── cluster.tf

    ├── iam.tf ├── logging.tf ├── main.tf ├── spotinst.tf ├── terraform.tf ├── variables.tf └── network.tf
  17. Terminal λ eks_addon % tree . ├── README.md ├── aws_auth.tf

    ├── configs ├── helm.tf ├── jobs.tf ├── main.tf ├── metric-server.tf ├── nginx-ingress.tf ├── rbac.tf ├── spotinst.tf ├── terraform.tf └── variables.tf