GithubHelp home page GithubHelp logo

sethpollack / terraform-aws-eks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from terraform-aws-modules/terraform-aws-eks

0.0 2.0 0.0 1.62 MB

A Terraform module to create an Elastic Kubernetes (EKS) cluster and associated worker instances on AWS.

Home Page: https://registry.terraform.io/modules/terraform-aws-modules/eks/aws

License: MIT License

Ruby 1.35% HCL 94.60% Smarty 3.15% Shell 0.90%

terraform-aws-eks's Introduction

terraform-aws-eks

A terraform module to create a managed Kubernetes cluster on AWS EKS. Available through the Terraform registry. Inspired by and adapted from this doc and its source code. Read the AWS docs on EKS to get connected to the k8s dashboard.

Branch Build status
master build Status

Assumptions

  • You want to create an EKS cluster and an autoscaling group of workers for the cluster.
  • You want these resources to exist within security groups that allow communication and coordination. These can be user provided or created within the module.
  • You've created a Virtual Private Cloud (VPC) and subnets where you intend to put the EKS resources.
  • If using the default variable value (true) for configure_kubectl_session, it's required that both kubectl (>=1.10) and aws-iam-authenticator are installed and on your shell's PATH.

Usage example

A full example leveraging other community modules is contained in the examples/eks_test_fixture directory. Here's the gist of using it via the Terraform registry:

module "eks" {
  source                = "terraform-aws-modules/eks/aws"
  cluster_name          = "test-eks-cluster"
  subnets               = ["subnet-abcde012", "subnet-bcde012a"]
  tags                  = "${map("Environment", "test")}"
  vpc_id                = "vpc-abcde012"
}

Other documentation

Release schedule

Generally the maintainers will try to release the module once every 2 weeks to keep up with PR additions. If particularly pressing changes are added or maintainers come up with the spare time (hah!), release may happen more often on occasion.

Testing

This module has been packaged with awspec tests through kitchen and kitchen-terraform. To run them:

  1. Install rvm and the ruby version specified in the Gemfile.

  2. Install bundler and the gems from our Gemfile:

    gem install bundler && bundle install
  3. Ensure your AWS environment is configured (i.e. credentials and region) for test.

  4. Test using bundle exec kitchen test from the root of the repo.

For now, connectivity to the kubernetes cluster is not tested but will be in the future. If configure_kubectl_session is set true, once the test fixture has converged, you can query the test cluster from that terminal session with kubectl get nodes --watch --kubeconfig kubeconfig.

Doc generation

Documentation should be modified within main.tf and generated using terraform-docs. Generate them like so:

go get github.com/segmentio/terraform-docs
terraform-docs md ./ | cat -s | tail -r | tail -n +2 | tail -r > README.md

Contributing

Report issues/questions/feature requests on in the issues section.

Full contributing guidelines are covered here.

IAM Permissions

Testing and using this repo requires a minimum set of IAM permissions. Test permissions are listed in the eks_test_fixture README.

Change log

The changelog captures all important release notes.

Authors

Created and maintained by Brandon O'Connor - [email protected]. Many thanks to the contributors listed here!

License

MIT Licensed. See LICENSE for full details.

Inputs

Name Description Type Default Required
cluster_name Name of the EKS cluster. Also used as a prefix in names of related resources. string - yes
cluster_security_group_id If provided, the EKS cluster will be attached to this security group. If not given, a security group will be created with necessary ingres/egress to work with the workers and provide API access to your current IP/32. string `` no
cluster_version Kubernetes version to use for the EKS cluster. string 1.10 no
config_output_path Determines where config files are placed if using configure_kubectl_session and you want config files to land outside the current working directory. Should end in a forward slash / . string ./ no
create_elb_service_linked_role Whether to create the service linked role for the elasticloadbalancing service. Without this EKS cannot create ELBs. string false no
kubeconfig_aws_authenticator_additional_args Any additional arguments to pass to the authenticator such as the role to assume. e.g. ["-r", "MyEksRole"]. list <list> no
kubeconfig_aws_authenticator_command Command to use to to fetch AWS EKS credentials. string aws-iam-authenticator no
kubeconfig_aws_authenticator_env_variables Environment variables that should be used when executing the authenticator. e.g. { AWS_PROFILE = "eks"}. map <map> no
kubeconfig_name Override the default name used for items kubeconfig. string `` no
manage_aws_auth Whether to write and apply the aws-auth configmap file. string true no
map_accounts Additional AWS account numbers to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. list <list> no
map_roles Additional IAM roles to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. list <list> no
map_users Additional IAM users to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. list <list> no
subnets A list of subnets to place the EKS cluster and workers within. list - yes
tags A map of tags to add to all resources. map <map> no
vpc_id VPC where the cluster and workers will be deployed. string - yes
worker_additional_security_group_ids A list of additional security group ids to attach to worker instances list <list> no
worker_group_count The number of maps contained within the worker_groups list. string 1 no
worker_groups A list of maps defining worker group configurations. See workers_group_defaults for valid keys. list <list> no
worker_security_group_id If provided, all workers will be attached to this security group. If not given, a security group will be created with necessary ingres/egress to work with the EKS cluster. string `` no
worker_sg_ingress_from_port Minimum port number from which pods will accept communication. Must be changed to a lower value if some pods in your cluster will expose a port lower than 1025 (e.g. 22, 80, or 443). string 1025 no
workers_group_defaults Override default values for target groups. See workers_group_defaults_defaults in locals.tf for valid keys. map <map> no
write_kubeconfig Whether to write a kubeconfig file containing the cluster configuration. string true no

Outputs

Name Description
cluster_certificate_authority_data Nested attribute containing certificate-authority-data for your cluster. This is the base64 encoded certificate data required to communicate with your cluster.
cluster_endpoint The endpoint for your EKS Kubernetes API.
cluster_id The name/id of the EKS cluster.
cluster_security_group_id Security group ID attached to the EKS cluster.
cluster_version The Kubernetes server version for the EKS cluster.
config_map_aws_auth A kubernetes configuration to authenticate to this EKS cluster.
kubeconfig kubectl config file contents for this EKS cluster.
worker_iam_role_arn IAM role ID attached to EKS workers
worker_iam_role_name IAM role name attached to EKS workers
worker_security_group_id Security group ID attached to the EKS workers.
workers_asg_arns IDs of the autoscaling groups containing workers.
workers_asg_names Names of the autoscaling groups containing workers.

terraform-aws-eks's People

Contributors

brandonjbjelland avatar max-rocket-internet avatar jimbeck avatar ozbillwang avatar sdavids13 avatar laverya avatar bshelton229 avatar erks avatar dpiddockcmp avatar dpiddock avatar tsub avatar artursmet avatar kppullin-nt avatar lcharkiewicz avatar rochacon avatar eric-gonzales avatar

Watchers

James Cloos avatar  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.