You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/privatelink-access/README.md
+79-40Lines changed: 79 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,8 @@
2
2
3
3
This example demonstrates how to access a private EKS cluster using AWS PrivateLink.
4
4
5
-
Refer to the [documentation](https://docs.aws.amazon.com/vpc/latest/privatelink/concepts.html) for further details on `AWS PrivateLink`.
5
+
Refer to the [documentation](https://docs.aws.amazon.com/vpc/latest/privatelink/concepts.html)
6
+
for further details on `AWS PrivateLink`.
6
7
7
8
## Prerequisites:
8
9
@@ -14,7 +15,9 @@ Ensure that you have the following tools installed locally:
14
15
15
16
## Deploy
16
17
17
-
To provision this example, first deploy the Lambda function that responds to `CreateNetworkInterface` API calls. This needs to exist before the cluster is created so that it can respond to the ENIs created by the EKS control plane:
18
+
To provision this example, first deploy the Lambda function that responds to
19
+
`CreateNetworkInterface` API calls. This needs to exist before the cluster is
20
+
created so that it can respond to the ENIs created by the EKS control plane:
18
21
19
22
```sh
20
23
terraform init
@@ -35,62 +38,98 @@ Enter `yes` at command prompt to apply
35
38
36
39
### Network Connectivity
37
40
38
-
1. An output `ssm_test` has been provided to aid in quickly testing the connectivity from the client EC2 instance to the private EKS cluster via AWS Privatelink. Copy the output value and paste it into your terminal to execute and check the connectivity. If configured correctly, the value returned should be `ok`.
41
+
An output `ssm_test` has been provided to aid in quickly testing the
42
+
connectivity from the client EC2 instance to the private EKS cluster via AWS
43
+
PrivateLink. Copy the output value and paste it into your terminal to execute
44
+
and check the connectivity. If configured correctly, the value returned should
To test access to the cluster, you will need to execute Kubernetes API calls from within the private network to access the cluster. An EC2 instance has been deployed to simulate this scenario, where the EC2 is deployed into a "client" VPC. However, since the EKS cluster was created with your local IAM identity, the `aws-auth` ConfigMap will only have your local identity that is permitted to access the cluster. Since cluster's API endpoint is private, we cannot use Terraform to reach it to additional entries to the ConfigMap; we can only access the cluster from within the private network of the cluster's VPC or from the client VPC using AWS PrivateLink access.
66
+
To test access to the cluster, you will need to execute Kubernetes API calls
67
+
from within the private network to access the cluster. An EC2 instance has been
68
+
deployed into a "client" VPC to simulate this scenario. However, since the EKS
69
+
cluster was created with your local IAM identity, the `aws-auth` ConfigMap will
70
+
only have your local identity that is permitted to access the cluster. Since
71
+
cluster's API endpoint is private, we cannot use Terraform to reach it to
72
+
add additional entries to the ConfigMap; we can only access the cluster from
73
+
within the private network of the cluster's VPC or from the client VPC using AWS
74
+
PrivateLink access.
51
75
52
-
:warning: The "client" EC2 instance provided and copying of AWS credentials to that instance are merely for demonstration purposes only. Please consider alternate methods of network access such as AWS Client VPN to provide more secure access.
76
+
> :warning: The "client" EC2 instance provided and copying of AWS credentials to
77
+
that instance are merely for demonstration purposes only. Please consider
78
+
alternate methods of network access such as AWS Client VPN to provide more
79
+
secure access.
53
80
54
-
Perform the following steps to access the cluster with `kubectl` from the provided "client" EC2 instance.
81
+
Perform the following steps to access the cluster with `kubectl` from the
82
+
provided "client" EC2 instance.
55
83
56
-
1. Execute the command below on your local machine to get temporary credentials that will be used on the "client" EC2 instance:
84
+
1. Execute the command below on your local machine to get temporary credentials
2. Start a new SSM session on the "client" EC2 instance using the provided `ssm_start_session` output value. Your terminal will now be connected to the "client" EC2 instance.
91
+
2. Start a new SSM session on the "client" EC2 instance using the provided
92
+
`ssm_start_session` output value. Copy the output value and paste it into your
93
+
terminal to execute. Your terminal will now be connected to the "client" EC2
3. Once logged in, export the following environment variables from the output of step 1. Note - the session credentials are only valid for 1 hour; you can adjust the session duration in the command provided in step 1:
100
+
3. Once logged in, export the following environment variables from the output
101
+
of step #1:
69
102
70
-
```sh
71
-
export AWS_ACCESS_KEY_ID=XXXX
72
-
export AWS_SECRET_ACCESS_KEY=YYYY
73
-
export AWS_SESSION_TOKEN=ZZZZ
74
-
```
103
+
> :exclamation: The session credentials are only valid for 1 hour; you can
104
+
adjust the session duration in the command provided in step #1
75
105
76
-
4. Update the local `~/.kube/config` file to enable access to the cluster:
0 commit comments