Browse the Repo

file-type-icondata-stores
file-type-iconlambda
file-type-iconmgmt
file-type-iconnetworking
file-type-iconsecurity
file-type-iconservice-templates
file-type-iconservices
file-type-iconasg-service
file-type-iconbeanstalk-service
file-type-iconecs-cluster
file-type-iconecs-service-with-alb
file-type-iconeks-cluster
file-type-iconeks-core-services
file-type-iconk8s-namespace
file-type-iconk8s-service
file-type-iconmigration_guides
file-type-icontemplates
file-type-iconREADME.md
file-type-icondependencies.tf
file-type-iconmain.tf
file-type-iconvariables.tf
file-type-iconstatic-website
file-type-icontls-scripts
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconREADME.md

Browse the Repo

file-type-icondata-stores
file-type-iconlambda
file-type-iconmgmt
file-type-iconnetworking
file-type-iconsecurity
file-type-iconservice-templates
file-type-iconservices
file-type-iconasg-service
file-type-iconbeanstalk-service
file-type-iconecs-cluster
file-type-iconecs-service-with-alb
file-type-iconeks-cluster
file-type-iconeks-core-services
file-type-iconk8s-namespace
file-type-iconk8s-service
file-type-iconmigration_guides
file-type-icontemplates
file-type-iconREADME.md
file-type-icondependencies.tf
file-type-iconmain.tf
file-type-iconvariables.tf
file-type-iconstatic-website
file-type-icontls-scripts
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconREADME.md
Sample Infrastructure Modules

Sample Infrastructure Modules

Sample infrastructure-modules repo (multi-account setup) for fictional company Acme.

Code Preview

Preview the Code

mobile file icon

README.md

down

Kubernetes Service Module

This Terraform Module can be used deploy a typical dockerized web service on Kubernetes. Under the hood this module uses the k8s-service Helm Chart to deploy a Kubernetes Deployment for a given Docker container with a Service resource. Optionally, this module can also provision an Ingress resource, which can be used to front the service with an ALB and corresponding Route 53 Domain records to allow external access to the deployed service.

How do you use this module?

  • See the root README for instructions on using Terraform modules.
  • See variables.tf for all the variables you can set on this module.

What is Helm?

Helm is a package manager for Kubernetes that can be used to install various services on to the EKS cluster. You use helm through the helm CLI, which uses the Kubernetes API to deploy the resources. helm tracks its releases in Secret resources on the cluster, which it uses to track all the charts that have been deployed. This allows for various rollout functionality, such as tracking failed deployments for rolling backwards to a previous release or forwards to new releases.

You can read more about Helm in the official documentation.

What is a Kubernetes Deployment?

Deployment resources are Kubernetes controllers that ensure a desired state of Pods is kept in the cluster. If the state of Pods on a cluster deviates from the desired state, the controller will automatically make the necessary changes to match the desired state. For example, if the desired state is to keep 3 Pods running, and one of the Pods fails, the controller will automatically replace it with a new Pod.

Deployments automatically provide various features for an application deployment on Kubernetes, such as rollback, canary deployments, and rolling updates.

You can learn more about all the various features of Deployments in the official documentation.

What is a Kubernetes Service?

Service resources define stable endpoints for your Pods in a Deployment. In Kubernetes, Pods are considered ephemeral resources, and they are designed to come and go at any given point in time. This means that you have a constantly changing environment of Pods, which makes it difficult to have a stable address to access your Pods. Services provide a consistent endpoint that can be used to access a group of Pods. The Service resource will automatically load balance your requests across all the Pods that match the given criteria, even if the number of Pods backing the Service changes.

In addition to having a consistent IP address, Services also have an internal DNS hostname that can be used to address it. All Services within a Kubernetes cluster can be reached under the domain name pattern {SVCNAME}.{NAMESPACE}.svc.cluster.local. This provides an automated way to perform service discovery for your applications.

You can read more about Services in the official documenation.

What is a Kubernetes Ingress?

Ingress resources configure a "Layer 7" load balancer for HTTP web applications. Ingress resources allow you to expose internal Services to be accessible from outside the cluster, depending on the flavor of Ingress controller you choose to deploy to your cluster. Ingress controllers take Ingress resources and map them to an actual load balancer.

The eks-core-services module can be used to deploy the AWS ALB Ingress Controller to your EKS cluster, allowing you to use Ingress resources to create ALBs that automatically map to the Service endpoint deployed using this module.

Additionally, if you provide a hostname for the service that has a corresponding Route 53 Hosted Zone, the external-dns app (also deployed using the eks-core-services module) will updated the Hosted Zone with a record that maps the domain hostname to the newly provisioned ALB. This allows you to provide a consistent endpoint that is accessible from outside the Kubernetes cluster.

Core concepts

For more information, check out the following documentation:

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?