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: doc/howto/usage/k8s/k8s_aws_en.md
+92-46Lines changed: 92 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,18 +2,16 @@
2
2
3
3
## Create AWS Account and IAM Account
4
4
5
-
AWS account allow us to manage AWS from Web Console. Amazon AMI enable us to manage AWS from command line interface.
6
-
7
-
We need to create an AMI user with sufficient privilege to create kubernetes cluster on AWS.
5
+
Under each AWS account, we can create multiple [IAM](http://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html) users. This allows us to grant some privileges to each IAM user and to create/operate AWS clusters as an IAM user.
Please be aware that this tutorial needs the following privileges for the user in AMI:
14
+
Please be aware that this tutorial needs the following privileges for the user in IAM:
17
15
18
16
- AmazonEC2FullAccess
19
17
- AmazonS3FullAccess
@@ -27,14 +25,6 @@ Please be aware that this tutorial needs the following privileges for the user i
27
25
- AWSKeyManagementServicePowerUser
28
26
29
27
30
-
By the time we write this tutorial, we noticed that Chinese AWS users
31
-
might suffer from authentication problems when running this tutorial.
32
-
Our solution is that we create a VM instance with the default Amazon
33
-
AMI and in the same zone as our cluster runs, so we can SSH to this VM
34
-
instance as a tunneling server and control our cluster and jobs from
35
-
it.
36
-
37
-
38
28
## PaddlePaddle on AWS
39
29
40
30
Here we will show you step by step on how to run PaddlePaddle training on AWS cluster.
@@ -59,7 +49,7 @@ gpg2 --fingerprint FC8A365E
59
49
```
60
50
The correct key fingerprint is `18AD 5014 C99E F7E3 BA5F 6CE9 50BD D3E0 FC8A 365E`
61
51
62
-
Go to the [releases](https://github.com/coreos/kube-aws/releases) and download the latest release tarball and detached signature (.sig) for your architecture.
52
+
We can download `kube-aws` from its [release page](https://github.com/coreos/kube-aws/releases). In this tutorial, we use version 0.9.1
Make the kubectl binary executable and move it to your PATH (e.g. `/usr/local/bin`):
92
+
93
+
```
94
+
chmod +x ./kubectl
95
+
sudo mv ./kubectl /usr/local/bin/kubectl
96
+
```
99
97
100
98
### Configure AWS Credentials
101
99
@@ -109,17 +107,18 @@ aws configure
109
107
```
110
108
111
109
112
-
Fill in the required fields (You can get your AWS aceess key id and AWS secrete access key by following [this](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html) instruction):
110
+
Fill in the required fields:
113
111
114
112
115
113
```
116
114
AWS Access Key ID: YOUR_ACCESS_KEY_ID
117
115
AWS Secrete Access Key: YOUR_SECRETE_ACCESS_KEY
118
-
Default region name: us-west-2
116
+
Default region name: us-west-1
119
117
Default output format: json
120
-
121
118
```
122
119
120
+
`YOUR_ACCESS_KEY_ID`, and `YOUR_SECRETE_ACCESS_KEY` is the IAM key and secret from [Create AWS Account and IAM Account](#create-aws-account-and-iam-account)
121
+
123
122
Verify that your credentials work by describing any instances you may already have running on your account:
124
123
125
124
```
@@ -134,7 +133,9 @@ The keypair that will authenticate SSH access to your EC2 instances. The public
134
133
135
134
Follow [EC2 Keypair docs](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) to create a EC2 key pair
136
135
137
-
After creating a key pair, you will use the name you gave the keys to configure the cluster. Key pairs are only available to EC2 instances in the same region.
136
+
After creating a key pair, you will use the key pair name to configure the cluster.
137
+
138
+
Key pairs are only available to EC2 instances in the same region. We are using us-west-1 in our tutorial, so make sure to creat key pairs in that region (N. California).
138
139
139
140
#### KMS key
140
141
@@ -143,12 +144,12 @@ Amazon KMS keys are used to encrypt and decrypt cluster TLS assets. If you alrea
143
144
You can create a KMS key in the AWS console, or with the aws command line tool:
`AWS_ACCOUNT_ID`: You can get it from following command line:
206
+
207
+
```
208
+
aws sts get-caller-identity --output text --query Account
209
+
```
210
+
211
+
`MY_CLUSTER_NAME`: Pick a MY_CLUSTER_NAME that you like, you will use it later as well.
204
212
205
213
#### External DNS name
206
214
207
-
When the cluster is created, the controller will expose the TLS-secured API on a public IP address. You will need to create an A record for the external DNS hostname you want to point to this IP address. You can find the API external IP address after the cluster is created by invoking kube-aws status.
215
+
When the cluster is created, the controller will expose the TLS-secured API on a DNS name.
216
+
217
+
The A record of that DNS name needs to be point to the cluster ip address.
218
+
219
+
We will need to use DNS name later in tutorial. If you don't already own one, you can choose any DNS name (e.g., `paddle`) and modify `/etc/hosts` to associate cluster ip with that DNS name.
208
220
209
221
#### S3 bucket
210
222
211
223
You need to create an S3 bucket before startup the Kubernetes cluster.
212
224
213
-
command (need to have a global unique name):
225
+
There are some bugs in aws cli in creating S3 bucket, so let's use the [Web console](https://console.aws.amazon.com/s3/home?region=us-west-1).
Here `us-west-1c` is used for parameter `--availability-zone`, but supported availability zone varies among AWS accounts.
251
+
`MY_CLUSTER_NAME`: the one you picked in [KMS key](#kms-key)
243
252
244
-
Please check if `us-west-1c` is supported by `aws ec2 --region us-west-1 describe-availability-zones`, if not switch to other supported availability zone. (e.g., `us-west-1a`, or `us-west-1b`)
253
+
`MY_EXTERNAL_DNS_NAME`: see [External DNS name](#external-dns-name)
254
+
255
+
`KEY_PAIR_NAME`: see [EC2 key pair](#ec2-key-pair)
256
+
257
+
`--kms-key-arn`: the "Arn" in [KMS key](#kms-key)
258
+
259
+
Here `us-west-1a` is used for parameter `--availability-zone`, but supported availability zone varies among AWS accounts.
260
+
261
+
Please check if `us-west-1a` is supported by `aws ec2 --region us-west-1 describe-availability-zones`, if not switch to other supported availability zone. (e.g., `us-west-1a`, or `us-west-1b`)
262
+
263
+
Note: please don't use `us-west-1c`. Subnets can currently only be created in the following availability zones: us-west-1b, us-west-1a.
245
264
246
265
There will now be a cluster.yaml file in the asset directory. This is the main configuration file for your cluster.
247
266
267
+
248
268
#### Render contents of the asset directory
249
269
250
270
In the simplest case, you can have kube-aws generate both your TLS identities and certificate authority for you.
251
271
252
272
```
253
-
$ kube-aws render credentials --generate-ca
273
+
kube-aws render credentials --generate-ca
254
274
```
255
275
256
276
The next command generates the default set of cluster assets in your asset directory.
257
277
258
278
```
259
-
sh $ kube-aws render stack
279
+
kube-aws render stack
260
280
```
261
281
262
282
Here's what the directory structure looks like:
@@ -292,15 +312,41 @@ These assets (templates and credentials) are used to create, update and interact
292
312
293
313
#### Create the instances defined in the CloudFormation template
294
314
295
-
Now for the exciting part, creating your cluster (choose any `<prefix>`):
315
+
Now let's create your cluster (choose any PREFIX for the command below):
296
316
297
317
```
298
-
$ kube-aws up --s3-uri s3://<your-bucket-name>/<prefix>
318
+
kube-aws up --s3-uri s3://BUCKET_NAME/PREFIX
299
319
```
300
320
321
+
`BUCKET_NAME`: the bucket name that you used in [S3 bucket](#s3-bucket)
322
+
323
+
301
324
#### Configure DNS
302
325
303
-
You can invoke `kube-aws status` to get the cluster API endpoint after cluster creation, if necessary. This command can take a while. And use command `dig` to check the load balancer hostname to get the ip address, use this ip to setup an A record for your external dns name.
326
+
You can invoke `kube-aws status` to get the cluster API endpoint after cluster creation.
327
+
328
+
```
329
+
$ kube-aws status
330
+
Cluster Name: paddle-cluster
331
+
Controller DNS Name: paddle-cl-ElbAPISe-EEOI3EZPR86C-531251350.us-west-1.elb.amazonaws.com
332
+
```
333
+
334
+
Use command `dig` to check the load balancer hostname to get the ip address.
0 commit comments