Skip to content

Commit 685384f

Browse files
committed
working on EKS README
1 parent fc04619 commit 685384f

File tree

1 file changed

+24
-31
lines changed

1 file changed

+24
-31
lines changed

_examples/eks/README.md

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,37 @@
1-
# Amazon EKS Clusters
1+
# EKS (Amazon Elastic Kubernetes Service)
22

3-
You will need the standard AWS environment variables to be set, e.g.
3+
This example shows how to use the Terraform Kubernetes Provider and Terraform Helm Provider to configure an EKS cluster. The example builds the EKS cluster and applies the Kubernetes configurations in a single operation.
4+
5+
You will need the following environment variables to be set:
46

57
- `AWS_ACCESS_KEY_ID`
68
- `AWS_SECRET_ACCESS_KEY`
79

8-
See [AWS Provider docs](https://www.terraform.io/docs/providers/aws/index.html#configuration-reference) for more details about these variables
9-
and alternatives, like `AWS_PROFILE`.
10+
See [AWS Provider docs](https://www.terraform.io/docs/providers/aws/index.html#configuration-reference) for more details about these variables and alternatives, like `AWS_PROFILE`.
11+
12+
To install the EKS cluster using default values, run terraform init and apply from the directory containing this README.
13+
14+
```
15+
terraform init
16+
terraform apply
17+
```
1018

11-
## Versions
19+
Optionally, the Kubernetes version can also be specified:
1220

13-
You can set the desired version of Kubernetes via the `kubernetes_version` TF variable.
21+
```
22+
terraform apply -var=kubernetes_version=1.18
23+
```
1424

1525
See https://docs.aws.amazon.com/eks/latest/userguide/platform-versions.html for currently available versions.
1626

17-
You can set the desired version of Kubernetes via the `kubernetes_version` TF variable, like this:
27+
## Kubeconfig for manual CLI access
28+
29+
This example generates a kubeconfig file in the current working directory. However, the token in this config expires in 15 minutes. I can be refreshed by running `terraform apply` again. Export the KUBECONFIG to manually access the cluster.
30+
1831
```
19-
export TF_VAR_kubernetes_version="1.18"
32+
export KUBECONFIG=$(terraform output kubeconfig_path)
33+
kubectl get pods -n test
2034
```
21-
Alternatively you can pass it to the `apply` command line, like below.
2235

2336
## Worker node count and instance type
2437

@@ -27,30 +40,10 @@ You can control the amount of worker nodes in the cluster as well as their machi
2740
- `TF_VAR_workers_count`
2841
- `TF_VAR_workers_type`
2942

30-
Export values for them or pass them to the apply command line.
43+
Export values for them or pass them to the apply command line:
3144

32-
## Build the cluster
33-
34-
```
35-
terraform init
36-
terraform apply -var=kubernetes_version=1.19
37-
```
38-
39-
## Exporting K8S variables
40-
To access the cluster you need to export the `KUBECONFIG` variable pointing to the `kubeconfig` file for the current cluster.
4145
```
42-
export KUBECONFIG="$(terraform output kubeconfig_path)"
46+
terraform apply -var=workers_count=4 -var=workers_type=m4.xlarge
4347
```
4448

45-
Now you can access the cluster via `kubectl` and you can run acceptance tests against it.
4649

47-
To run acceptance tests, your the following command in the root of the repository.
48-
```
49-
TESTARGS="-run '^TestAcc'" make testacc
50-
```
51-
52-
To run only a specific set of tests, you can replace `^TestAcc` with any regular expression to filter tests by name.
53-
For example, to run tests for Pod resources, you can do:
54-
```
55-
TESTARGS="-run '^TestAccKubernetesPod_'" make testacc
56-
```

0 commit comments

Comments
 (0)