Giter VIP home page Giter VIP logo

terraform-helm-eks-jenkins's Introduction

DEPLOY HELM CHARTS LIKE JENKINS AND EKS USING TERRAFORM

Need some apps on that cluster really fast? Use Terraforms Helm Provider on top of their Kubernetes provider to quickly deploy EKS clusters with your apps on top of them. In this example, I'm deploying Jenkins on EKS. It takes about 15 minutes from start to finish and minimal work.

Note: This is not meant for production!!

Pre-requisites

  • Terraform CLI installed or a Terraform Cloud account.
  • AWS credentials configured.
  • kubectl installed.

Deployment Instructions

  • Clone this repository
  • Edit terraform.tfvars to match your values.
  • Run a terraform init to grab providers and modules.
  • Run a terraform plan to view the plan.
  • Run a terraform_apply and wait 10 - 15 minutes.

Note: If it fails for HTTP timeout while waiting to apply the Helm chart, retry terraform_apply

  • Run aws eks --region us-east-1 update-kubeconfig --name dev-cluster to add the cluster context to your kubeconfig.
  • Run kubectl get pods to ensure Jenkins deployed as expected.
  • Run kubectl get svc to grab the AWS created DNS address for the jenkins service.
  • Go to your browser and navigate to http://<dns-address>:8080 Note: This may take 3 - 5 minutes to resolve while waiting for Jenkins to fully initialize.
  • Log in with the credentials you set in terraform.tfvars.

Connecting

  • Run aws eks --region us-east-1 update-kubeconfig --name dev-cluster to add the context to your kubeconfig file.

Requirements

Name Version
terraform ~> 1.2.6

Providers

Name Version
aws 4.21.0
helm 2.6.0
kubernetes 2.12.1

Modules

Name Source Version
my-cluster terraform-aws-modules/eks/aws 18.28.0

Resources

Name Type
aws_internet_gateway.dev-gw resource
aws_route_table.dev-route-table resource
aws_route_table_association.dev1-sub-to-dev-rt resource
aws_route_table_association.dev2-sub-to-dev-rt resource
aws_security_group.allow-web-traffic resource
aws_subnet.dev1-subnet resource
aws_subnet.dev2-subnet resource
aws_vpc.dev-vpc resource
helm_release.jenkins resource
aws_eks_cluster.dev-cluster data source
aws_eks_cluster_auth.dev-cluster data source

Inputs

Name Description Type Default Required
autoscaling_group_desired_capacity The desired number of nodes the worker group should attempt to maintain. number 2 no
autoscaling_group_max_size The maximum number of nodes the worker group can scale to. number 3 no
autoscaling_group_min_size The minimum number of nodes the worker group can scale to. number 1 no
aws_region The AWS region for the provider to deploy resources into. string "us-east-1" no
cluster_name The name of the EKS cluster. string "dev-cluster" no
cluster_version The version of the EKS cluster. string "1.22" no
create_cluster_primary_security_group_tags Indicates whether or not to tag the cluster's primary security group. This security group is created by the EKS service, not the module, and therefore tagging is handled after cluster creation bool true no
dev1_subnet_az Availability Zone of the subnet 1. string "us-east-1a" no
dev1_subnet_cidr_block CIDR block of subnet 1 to create. string "10.0.1.0/24" no
dev1_subnet_nic_private_ip CIDR block of subnet 1 to create. list(string)
[
"10.0.1.50"
]
no
dev2_subnet_az Availability zone of subnet 2. string "us-east-1b" no
dev2_subnet_cidr_block CIDR block of subnet 1 to create. string "10.0.2.0/24" no
jenkins_admin_password Admin password of the Jenkins Application. string n/a yes
jenkins_admin_user Admin user of the Jenkins Application. string "admin" no
vpc_cidr_block CIDR block of the VPC to create. string "10.0.0.0/16" no
worker_group_instance_type The instance type of the worker group nodes. Must be large enough to support the amount of NICS assigned to pods. list(string)
[
"t3.medium"
]
no
worker_group_name The name of the EKS worker node group. string "dev-worker-group-1" no

Troubleshooting

Pods stuck in Pending

  • Possibility of resources not efficient. The instances in the worker group could be too small to assign IP addresses to all the pods

Workers not joining the cluster

  • Ensure the workers are getting public IP addresses

Pods Crashing

  • Run kubectl logs --previous -p jenkins-0 -c init to view the logs for the Jenkins init container.

terraform-helm-eks-jenkins's People

Contributors

josh-tracy avatar hatdropper1977 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.