Skip to content

Commit f4797c4

Browse files
authored
Merge pull request #54 from commitdev/documentation-update
Documentation update
2 parents 0af0680 + 1a7276a commit f4797c4

File tree

8 files changed

+126
-32
lines changed

8 files changed

+126
-32
lines changed

README.md

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,51 @@
1-
## Project board
2-
https://app.zenhub.com/workspaces/commit-zero-5da8decc7046a60001c6db44/board?filterLogic=any&repos=203630543,247773730,257676371,258369081
1+
# Overview
2+
A set of templates meant to work with [Zero], the templated result is a ready to scale infrastructure boilerplate built on top of AWS EKS baked with all best practices we have accumulated.
33

4-
# AWS EKS Stack
4+
## Repository structure
5+
The root folder is used for declaring parameters required by the templates, and [Zero][zero] will gather the required parameters and parse the templates as individual repositories for user to maintain.
6+
```sh
7+
/ # file in the root directory is for initializing the user's repo and declaring metadata
8+
|-- Makefile #make command triggers the initialization of repository
9+
|-- zero-module.yml #module declares required parameters and credentials
10+
|
11+
| # files in templates become the repo for users
12+
| templates/
13+
| | # this makefile is used both during init and
14+
| | # on-going needs/utilities for user to maintain their infrastructure
15+
| |-- Makefile
16+
| |-- terraform/
17+
| | |-- bootstrap/ #initial setup
18+
| | |-- environments/ #infrastructure setup
19+
| | | |-- production/
20+
| | | |-- staging/
21+
| |-- kubernetes
22+
| | |-- terraform
23+
| | | |-- environments #k8s-ultities
24+
| | | | |-- production/
25+
| | | | |-- staging/
26+
```
527

6-
This is a [zero](https://github.com/commitdev/zero) module which sets up a
28+
## AWS EKS Stack
29+
The Zero-awk-eks stack is designed with scalability and maintainability in mind, this repo is a series of templates indented to be filled in with modules parameters, and executed by zero
30+
This is a [Zero][zero] module which sets up a
731
hosting environment on AWS running Kubernetes. It will generate terraform output
8-
which describes the environment mapped in this [architecture
9-
diagram](./templates/docs/architecture-overview.svg).
32+
which describes the environment mapped in this [architecture diagram][arch-diagram].
33+
34+
**Resource List**: [Link][resource-list]
1035

1136
**Prerequisites**
1237
- Terraform installed
1338
- Kubectl installed
1439
- Wget installed
1540
- A valid AWS account
16-
- [Set up the AWS CLI](https://docs.aws.amazon.com/polly/latest/dg/setup-aws-cli.html)
17-
- [A domain registered with Route53](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-register.html)
18-
- Note: if you want to use different domain per environment (staging/poduction), you need to have multiple hosted zones. The available zones in Route53 can be found by running this command. `aws route53 list-hosted-zones`
41+
- [Set up the AWS CLI][aws-cli]
42+
- [A domain registered with Route53][aws-route53]
43+
- Note: if you want to use different domain per environment (staging/production), you need to have multiple hosted zones. The available zones in Route53 can be found by running this command. `aws route53 list-hosted-zones`
1944

2045
## Getting Started
2146

2247
This is meant to be used with the `zero` tool and not directly. See
23-
the [zero](https://github.com/commitdev/zero) repository for more
48+
the [Zero][zero] repository for more
2449
information. The tool will parse through configuration and fill in any
2550
template variables which need to be encoded into the terraform configuration.
2651

@@ -36,3 +61,15 @@ infrastructure:
3661
- EC2 (t2.small): $0.023 USD / hr
3762

3863
EC2 instance sizing can be configured in [terraform/environments/staging/main.tf](terraform/environments/staging/main.tf)
64+
65+
## Other links
66+
Project board: [zenhub][zenhub-board]
67+
68+
<!-- Links -->
69+
[zero]: https://github.com/commitdev/zero
70+
[arch-diagram]: ./docs/architecture-overview.svg
71+
[resource-list]: ./docs/resources.md
72+
<!-- External Links -->
73+
[aws-cli]: https://docs.aws.amazon.com/polly/latest/dg/setup-aws-cli.html
74+
[aws-route53]: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-register.html
75+
[zenhub-board]: https://app.zenhub.com/workspaces/commit-zero-5da8decc7046a60001c6db44/board?filterLogic=any&repos=203630543,247773730,257676371,258369081
File renamed without changes.
File renamed without changes.

templates/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ teardown-remote-state:
3535
export AWS_PAGER='' && export AWS_DEFAULT_REGION=<% index .Params `region` %> && \
3636
aws s3 rm s3://<% .Name %>-$(ENVIRONMENT)-terraform-state --recursive && \
3737
aws s3 rb s3://<% .Name %>-$(ENVIRONMENT)-terraform-state --force && \
38-
aws dynamodb delete-table --table-name <% .Name %>-$(ENVIRONMENT)-terraform-state-locks
38+
aws dynamodb delete-table --region <% index .Params `region` %> --table-name <% .Name %>-$(ENVIRONMENT)-terraform-state-locks
3939

4040
teardown-secrets:
4141
export AWS_PAGER='' && export AWS_DEFAULT_REGION=<% index .Params `region` %> && \
42-
aws secretsmanager list-secrets --query "SecretList[?Tags[?Key=='project' && Value=='<% .Name %>']].[Name] | [0][0]" | xargs aws secretsmanager delete-secret --secret-id && \
42+
aws secretsmanager list-secrets --region <% index .Params `region` %> --query "SecretList[?Tags[?Key=='project' && Value=='<% .Name %>']].[Name] | [0][0]" | xargs aws secretsmanager delete-secret --region <% index .Params `region` %> --secret-id && \
4343
aws iam delete-access-key --user-name <% .Name %>-ci-user --access-key-id $(shell aws iam list-access-keys --user-name <% .Name %>-ci-user --query "AccessKeyMetadata[0].AccessKeyId" | sed 's/"//g') && \
4444
aws iam delete-user --user-name <% .Name %>-ci-user
4545

templates/README.md

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
1-
# Infrastructure
21

3-
**Prerequisites**
4-
- Terraform installed
5-
- Kubectl installed
6-
- Wget installed
7-
- A valid AWS account
8-
- [Set up the AWS CLI](https://docs.aws.amazon.com/polly/latest/dg/setup-aws-cli.html)
9-
- [A domain registered with Route53](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-register.html)
10-
- Note: if you want to use different domain per environment (staging/poduction), you need to have multiple hosted zones. The available zones in Route53 can be found by running this command. `aws route53 list-hosted-zones`
112

12-
### Using the Kubernetes Cluster
3+
# Overview
4+
Your infrastructure should be up and running, your terraform repository is the source of truth for your infrastructure, here is [a list of components and resources][zero-resource-list] that comes with the EKS-stack
5+
6+
# How to
7+
## Managing your Terraform
8+
#### Why terraform
9+
The repository follows infrastructure as code as a core principle, it allows repeatable and reproducible infrastructures and makes DevOps much more manageable; to learn more about it we suggest reading the [Terraform's workflow guide][tf-workflow].
10+
11+
#### Intended workflows
12+
To make changes to the infrastructure you would modify the terraform code changing the components you wish to modify, then plan the changes with `terraform plan` to make sure you are making the desired changes; then apply the changes with `terraform apply` on your staging environment. Once you reach the satisfactory state, you should do the same on production environment and check-in the changes of your infrastructure code, as this repo should be the source of truth of your deployed infrastructure.
13+
Our infrastructure is divided into a few areas.
14+
1. Initial setup
15+
- [remote state][tf-remote-state]
16+
- [secrets][tf-secrets]
17+
2. Infrastructure
18+
- [production][tf-production-env]
19+
- [staging][tf-staging-env]
20+
3. Kubernetes utilities
21+
- [production][tf-production-utilities]
22+
- [staging][tf-staging-utilities]
23+
24+
25+
#### Style guide, resources, and Configuring your infrastructure as code
26+
For more information about the terraform in this repo, please see [Link][zero-tf-guide]
27+
28+
29+
## Using the Kubernetes Cluster
1330

1431
Before using the cluster the first time you'll need to set up your local `kubectl` context:
1532
```shell
@@ -26,13 +43,57 @@ kubectl get pods -A
2643
To init and apply the terraform configs, simply run the `make` and specify the
2744
environment. The default environment is `staging`
2845
```shell
29-
$ make ENV=<environment>
46+
$ make ENVIRONMENT=<environment>
3047
```
3148

32-
3349
### Set up an application
3450
Configure your k8s context
3551

3652
```shell
3753
$ aws eks update-kubeconfig --name <cluster-name> --region us-east-1
3854
```
55+
56+
#### Extra features built into my kubernetes cluster
57+
Outlines and best practices utilities that comes with your EKS cluster.
58+
Please see [Link][zero-k8s-guide]
59+
- Dashboards
60+
- Logging
61+
- Monitoring
62+
- Ingress / TLS certificates (auto provisioning)
63+
- AWS IAM integration with Kubernetes RBAC
64+
...
65+
66+
# Resources
67+
### Infrastructure
68+
This [architecture-diagram][architecture-diagram] displays the original setup you get from the terraform templates
69+
70+
Commonly used links in AWS console
71+
|Resources |Links|
72+
|--- |---|
73+
|Route 53 |https://console.aws.amazon.com/route53/home |
74+
|IAM |https://console.aws.amazon.com/iam/home#/users|
75+
|ECR |https://console.aws.amazon.com/ecr/repositories|
76+
|RDS |https://console.aws.amazon.com/rds|
77+
### Suggested readings
78+
- [Terraform workflow][tf-workflow]
79+
- [Why do I want code as infrastructure][why-infra-as-code]
80+
-
81+
82+
83+
<!-- Links -->
84+
[tf-workflow]: https://www.terraform.io/guides/core-workflow.html
85+
[why-infra-as-code]: https://www.oreilly.com/library/view/terraform-up-and/9781491977071/ch01.html
86+
<!-- code -->
87+
[tf-remote-state]: ./terraform/bootstrap/remote-state
88+
[tf-secrets]: ./terraform/bootstrap/secrets
89+
[tf-production-env]: ./terraform/environments/production
90+
[tf-staging-env]: ./terraform/environments/staging
91+
92+
[tf-production-utilities]: ./kubernetes/terraform/environments/production
93+
[tf-staging-utilities]: ./kubernetes/terraform/environments/staging
94+
95+
[zero-tf-guide]: ./terraform/README.md
96+
[zero-k8s-guide]: ./kubernetes/terraform/modules/kubernetes/README.md
97+
[zero-architecture-diagram]: https://github.com/commitdev/zero-aws-eks-stack/blob/master/docs/architecture-overview.svg
98+
[zero-resource-list]: https://github.com/commitdev/zero-aws-eks-stack/blob/master/docs/resources.md
99+

templates/kubernetes/terraform/modules/kubernetes/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# kubernetes tf module
22

3-
## Introduction
4-
5-
This Terraform module contains configuration to provision kubernetes resources.
6-
73
## Core Components
84

95
[Nginx Ingress Controller](https://github.com/kubernetes/ingress-nginx/)

templates/terraform/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
- All environments should contain the following:
2929

30-
`main.tf`: Toplevel terraform configuration file that instantiates the `environment` module.
30+
`main.tf`: Top level terraform configuration file that instantiates the `environment` module.
3131

3232
- Configuration should be pushed "top->down" from the `environment` module to it's submodules.
3333

@@ -40,7 +40,7 @@
4040
`main.tf`: Module entrypoint where instantiation of resources happens.
4141
`backend.tf`: Terraform remote state configuration.
4242
`provider.tf`: Provider configuration.
43-
`variables.tf`: Environment-specific variables are desclared here.
43+
`variables.tf`: Environment-specific variables are declared here.
4444
`versions.tf`: Terraform version information.
4545
`files/`: (DEPRECATED)
4646

@@ -78,9 +78,9 @@
7878

7979
- When to use the Terraform Kuberenetes Provider and when to use manifests?
8080

81-
- Use the Terraform Kubernetes Provider (`provider "kubernetes"`) whenever you are provisioning a resource that could be considered relatively static (think Ingress, RoleBinding, CluterRoleBinding, etc).
81+
- Use the Terraform Kubernetes Provider (`provider "kubernetes"`) whenever you are provisioning a resource that could be considered relatively static (think Ingress, RoleBinding, ClusterRoleBinding, etc).
8282

83-
- Use conventional Kubernetes manifests / `kubectl` when provisioning resouirces that could be considered dynamic (think Deployments).
83+
- Use conventional Kubernetes manifests / `kubectl` when provisioning resources that could be considered dynamic (think Deployments).
8484

8585
## Application
8686

0 commit comments

Comments
 (0)