{"id":295,"date":"2018-10-16T07:34:17","date_gmt":"2018-10-16T07:34:17","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw93\/?p=295"},"modified":"2018-10-16T20:00:19","modified_gmt":"2018-10-16T20:00:19","slug":"getting-started-with-amazon-eks-provisioning-and-adding-clusters","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/10\/16\/getting-started-with-amazon-eks-provisioning-and-adding-clusters\/","title":{"rendered":"Getting Started with Amazon EKS &#8211; Provisioning and Adding Clusters"},"content":{"rendered":"<p><em>This is a simple tutorial on how to launch a new Amazon EKS cluster from scratch and attach to Codefresh.<\/em><\/p>\n<p>Have an existing Kubernetes cluster you want to add? Please see <a href=\"https:\/\/codefresh.io\/docs\/docs\/deploy-to-kubernetes\/adding-non-gke-kubernetes-cluster\/\">the docs<\/a>.<\/p>\n<p>The source code for this tutorial can be found here:<br \/>\n<a href=\"https:\/\/github.com\/codefresh-io\/eks-installer\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/codefresh-io\/eks-installer<\/a><\/p>\n<h2>Overview<\/h2>\n<p>Amazon Elastic Container Service for Kubernetes (<a href=\"https:\/\/aws.amazon.com\/eks\/\" target=\"_blank\" rel=\"noopener\">Amazon EKS<\/a>) is the latest product release from AWS, offering fully-hosted Kubernetes clusters.<\/p>\n<p>This is great news for AWS users, however it is not overly simple to understand how EKS fits in with various other AWS services.<\/p>\n<p>To help out others get started with Amazon EKS, I\u2019ve put together a Codefresh pipeline <a href=\"https:\/\/github.com\/codefresh-io\/eks-installer\/blob\/master\/.codefresh\/setup.yml\" target=\"_blank\" rel=\"noopener\">setup.yml<\/a> that does the following:<\/p>\n<ol>\n<li>Bootstraps an EKS cluster and VPC in your AWS account using <a href=\"https:\/\/www.terraform.io\/\" target=\"_blank\" rel=\"noopener\">Terraform<\/a><\/li>\n<li>Saves the Terraform statefile in a Codefresh context<\/li>\n<li>Creates some base Kubernetes resources<\/li>\n<li>Initializes Helm in the cluster<\/li>\n<li>Adds the cluster to your Codefresh account<\/li>\n<\/ol>\n<p>There is also a corresponding <a href=\"https:\/\/github.com\/codefresh-io\/eks-installer\/blob\/master\/.codefresh\/teardown.yml\" target=\"_blank\" rel=\"noopener\">teardown.yml<\/a> that:<\/p>\n<ol>\n<li>Loads the Terraform statefile from Codefresh context<\/li>\n<li>Destroys the EKS cluster from your AWS account using Terraform<\/li>\n<li>Removes the cluster from your Codefresh account<\/li>\n<\/ol>\n<p>Follow the instructions below to setup these pipelines in your account. After clicking the \u201cBuild\u201d button, your cluster should be ready to use in 10-20 minutes!<\/p>\n<h2>Setting up the Pipelines<\/h2>\n<h3>Add Repository and setup.yml pipeline<\/h3>\n<p>In your Codefresh account, at the top right of your screen click the \u201cAdd Repository\u201d button. Turn on \u201cAdd by URL\u201d. Enter the following repository URL (or create and use a fork):<br \/>\nhttps:\/\/github.com\/codefresh-io\/eks-installer<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/codefresh.io\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-9.55.47-PM.png\" alt=\"\" width=\"1190\" height=\"614\" \/><\/p>\n<p>Click \u201cNext\u201d. Click the \u201cSelect\u201d button under \u201cI have a Codefresh.yml file\u201d. For the path to codefresh.yml, enter the following:<br \/>\n.codefresh\/setup.yml<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/codefresh.io\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-10.03.26-PM.png\" alt=\"\" width=\"1172\" height=\"430\" \/><\/p>\n<p>Click through the rest of the dialogue to create the setup.yml pipeline.<\/p>\n<h3>Configure Triggers<\/h3>\n<p>Before going forward, make sure to delete any unwanted trigger configuration that may result in an unexpected EKS cluster launch:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/codefresh.io\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-10.10.12-PM.png\" alt=\"\" width=\"1492\" height=\"492\" \/><\/p>\n<h3>Add teardown.yml pipeline<\/h3>\n<p>In the same repository view, click the \u201cAdd Pipeline\u201d link. Name this pipeline something like \u201ceks-uninstaller\u201d.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/codefresh.io\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-10.16.23-PM.png\" alt=\"\" width=\"1196\" height=\"544\" \/><\/p>\n<p>At the bottom of the page, in the \u201cWorkflow\u201d section, select \u201cYAML\u201d. Click \u201cUse YAML from Repository\u201d. Enter the following:<br \/>\n.codefresh\/teardown.yml<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/codefresh.io\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-10.21.31-PM.png\" alt=\"\" width=\"1222\" height=\"506\" \/><\/p>\n<p>Click \u201cSave\u201d.<\/p>\n<h3>Setup Environment Variables<\/h3>\n<p>Under the \u201cGeneral\u201d tab, add the following global variables to be used by both of the pipelines:<\/p>\n<p>AWS_ACCESS_KEY_ID <em>encrypted<\/em> \u2013 AWS access key ID<br \/>\nAWS_SECRET_ACCESS_KEY <em>encrypted<\/em> \u2013 AWS secret access key<br \/>\nCLUSTER_NAME \u2013 unique EKS cluster name<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/codefresh.io\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-10.30.19-PM.png\" alt=\"\" width=\"1024\" height=\"378\" \/><\/p>\n<p>Additionally, you can add the following optional variables for fine-tuned setup:<\/p>\n<p>CLUSTER_SIZE \u2013 number of nodes in ASG (default: 1)<br \/>\nCLUSTER_REGION \u2013 AWS region to deploy to (default: us-west-2)<br \/>\nCLUSTER_INSTANCE_TYPE \u2013 EC2 instance type (default: m4.large)<\/p>\n<p>Note that at the time of writing, EKS is only available in regions us-east-1 and us-west-2 (and seems to have reached capacity in us-east-1). Your best best is to stick with us-west-2 for now.<\/p>\n<p>Click \u201cSave\u201d.<\/p>\n<h2>Create new EKS Cluster<\/h2>\n<p>At this point, all you need to do is click \u201cBuild\u201d on the setup.yml pipeline (eks-installer)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/codefresh.io\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-10.38.01-PM.png\" alt=\"\" width=\"254\" height=\"112\" \/><\/p>\n<p>and wait\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/codefresh.io\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-11.21.30-PM.png\" alt=\"\" width=\"783\" height=\"614\" \/><\/p>\n<p>Once the build is complete, navigate to the Kubernetes services page to view your newly-created EKS cluster in Codefresh:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/codefresh.io\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-20-at-12.05.42-AM.png\" alt=\"\" width=\"847\" height=\"237\" \/><\/p>\n<p>You can then use this cluster to deploy to from your pipelines etc.<\/p>\n<h2>Teardown EKS Cluster<\/h2>\n<p>Similar to steps above, all you need to do to teardown your EKS cluster is to click \u201cBuild\u201d on the teardown.yml pipeline (eks-uninstaller)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/codefresh.io\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-10.38.01-PM.png\" alt=\"\" width=\"254\" height=\"112\" \/><\/p>\n<p>and wait\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/codefresh.io\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-20-at-12.30.59-AM.png\" alt=\"\" width=\"818\" height=\"467\" \/><\/p>\n<p>Once the build is complete, the EKS cluster and all associated AWS resources will be destroyed, and the cluster will be removed from your Codefresh account.<\/p>\n<p><a href=\"https:\/\/codefresh.io\/kubernetes-tutorial\/getting-started-amazon-eks\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a simple tutorial on how to launch a new Amazon EKS cluster from scratch and attach to Codefresh. Have an existing Kubernetes cluster you want to add? Please see the docs. The source code for this tutorial can be found here: https:\/\/github.com\/codefresh-io\/eks-installer Overview Amazon Elastic Container Service for Kubernetes (Amazon EKS) is the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/10\/16\/getting-started-with-amazon-eks-provisioning-and-adding-clusters\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Getting Started with Amazon EKS &#8211; Provisioning and Adding Clusters&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-295","post","type-post","status-publish","format-standard","hentry","category-kubernetes"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/comments?post=295"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/295\/revisions"}],"predecessor-version":[{"id":397,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/295\/revisions\/397"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/media?parent=295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/categories?post=295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/tags?post=295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}