Skip to content

Commit d9e838e

Browse files
authored
Merge pull request aws-samples#538 from dalbhanj/master
minor fixes in 101, 102 & 103
2 parents fe60513 + 2b1869f commit d9e838e

File tree

4 files changed

+85
-15
lines changed

4 files changed

+85
-15
lines changed

01-path-basics/101-start-here/readme.adoc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Click on the "Deploy to AWS" button and follow the CloudFormation prompts to beg
2020

2121
[NOTE]
2222
AWS Cloud9 is currently available in 5 regions, and EKS is currently available in 2 regions (us-east-1 and us-west-2).
23-
Please choose the region closest to you. If you choose a region for Cloud9 that does not support EKS, you will need to change the `AWS_DEFAULT_REGION` environment variable later.
23+
Please choose the region closest to you. If you choose a region for Cloud9 that does not support EKS, you need to create VPC resources and change environment variables. This configuration has not been tested.
2424

2525
|===
2626

@@ -35,7 +35,11 @@ a| image::./deploy-to-aws.png[link=https://console.aws.amazon.com/cloudformation
3535

3636
|===
3737

38-
To open the Cloud9 IDE environment, click on the "Outputs" tab in CloudFormation Console and click on the "Cloud9IDE" URL.
38+
Accept the default stack name and Click *Next*. You can give Tags such as Key=Name, Value=k8s-workshop, and click *Next*. Make sure
39+
to check *I acknowledge that AWS CloudFormation might create IAM resources with custom names* and click *Create*.
40+
41+
CloudFormation creates nested stacks and builds several resources that are required for this workshop. Wait until all the resources are created. Once the status for *k8s-workshop* changes to *CREATE_COMPLETE*,
42+
you can open Cloud9 IDE. To open the Cloud9 IDE environment, click on the "Outputs" tab in CloudFormation Console and click on the "Cloud9IDE" URL.
3943

4044
image:cloudformation-output-tab.png[CloudFormation Output Tab]
4145

@@ -69,6 +73,7 @@ To install the script, run this command in the "bash" terminal tab of the Cloud9
6973

7074
image:cloud9-run-script.png[Running the script in Cloud9 Terminal]
7175

76+
7277
At this point you can restart the Cloud9 IDE terminal session to ensure that the kubectl completion is enabled. Once a new terminal window is opened, type `kubectl ver` and press `Tab` to autocomplete and press `Enter`. This will ensure that the `kubectl` tool is installed on the command line correctly and can autocomplete.
7378

7479
[NOTE]

01-path-basics/102-your-first-cluster/readme.adoc

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,54 @@ echo $EKS_SECURITY_GROUPS
6868
```
6969
If any of those environment variables are blank, please re-run the "Build Script" section of the link:../101-start-here[Cloud9 Environment Setup].
7070

71+
If you receive an *UnsupportedAvailabilityZoneException* error during EKS cluster creation, your account is using an AZ that is currently resource constrained. This occurs mostly in N.Virginia region (us-east-1).
72+
73+
```
74+
An error occurred (UnsupportedAvailabilityZoneException) when calling the CreateCluster operation: Cannot create cluster 'k8s-workshop' because us-east-1c,
75+
the targeted availability zone, does not currently have sufficient capacity to support the cluster. Retry and choose from these availability zones: us-east-1a, us-east-1b, us-east-1d
76+
```
77+
78+
If you receive this error, you need to remove the constrained AZ (us-east-1c in this example) from *`EKS_SUBNET_IDS`* environment variable. Follow these steps to update your environment variable.
79+
80+
Save the EKS recommended AZ's that is referred in your CLI output in an environment variable.
81+
Note: you only need two AZ's defined to create EKS cluster
82+
83+
$ export EKS_VALID_AZS=us-east-1a,us-east-1b
84+
85+
Run the command below to determine subnet ID's
86+
87+
$ aws ec2 describe-subnets --filters "Name=vpc-id,Values=$EKS_VPC_ID" "Name=availabilityZone,Values=$EKS_VALID_AZS" --query 'Subnets[*].[SubnetId]' --output text
88+
subnet-6e672524
89+
subnet-18b10e44
90+
91+
Save this output as `*EKS_SUBNET_IDS*` environment variable
92+
93+
$ export EKS_SUBNET_IDS=subnet-6e672524,subnet-18b10e44
94+
95+
Re-run EKS create-cluster and you should now be able to create cluster. The output should look similar to this
96+
97+
{
98+
"cluster": {
99+
"status": "CREATING",
100+
"name": "k8s-workshop",
101+
"certificateAuthority": {},
102+
"roleArn": "arn:aws:iam::123456789012:role/k8s-workshop-EksServiceRo-AWSServiceRoleForAmazonE-1PCSJFFFAF4BL",
103+
"resourcesVpcConfig": {
104+
"subnetIds": [
105+
"subnet-6e672524",
106+
"subnet-18b10e44"
107+
],
108+
"vpcId": "vpc-a779b4dd",
109+
"securityGroupIds": [
110+
"sg-d093de9a"
111+
]
112+
},
113+
"version": "1.10",
114+
"arn": "arn:aws:eks:us-east-1:123456789012:cluster/k8s-workshop",
115+
"createdAt": 1532734869.147
116+
}
117+
}
118+
71119
=== Create the configuration file
72120

73121
In order to access the cluster locally, use a configuration file (sometimes referred to as a `kubeconfig` file). This configuration file can be created automatically.
@@ -80,6 +128,12 @@ Once the cluster has moved to the `ACTIVE` state, download and run the `create-k
80128

81129
This will create a configuration file at `$HOME/.kube/config` and update the necessary environment variable for default access.
82130

131+
You can test your kubectl configuration using 'kubectl get service'
132+
133+
$ kubectl get service
134+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
135+
kubernetes ClusterIP 10.100.0.1 <none> 443/TCP 8m
136+
83137
=== Create the worker nodes
84138

85139
Now that your EKS master nodes are created, you can launch and configure your worker nodes.
@@ -115,6 +169,20 @@ To enable worker nodes to join your cluster, download and run the `aws-auth-cm.s
115169
Watch the status of your nodes and wait for them to reach the `Ready` status.
116170

117171
$ kubectl get nodes --watch
172+
NAME STATUS ROLES AGE VERSION
173+
ip-192-168-223-116.us-west-2.compute.internal NotReady <none> 0s v1.10.3
174+
ip-192-168-223-116.us-west-2.compute.internal NotReady <none> 0s v1.10.3
175+
ip-192-168-223-116.us-west-2.compute.internal NotReady <none> 0s v1.10.3
176+
ip-192-168-147-168.us-west-2.compute.internal NotReady <none> 0s v1.10.3
177+
ip-192-168-147-168.us-west-2.compute.internal NotReady <none> 0s v1.10.3
178+
ip-192-168-102-172.us-west-2.compute.internal NotReady <none> 0s v1.10.3
179+
ip-192-168-102-172.us-west-2.compute.internal NotReady <none> 0s v1.10.3
180+
ip-192-168-223-116.us-west-2.compute.internal NotReady <none> 10s v1.10.3
181+
ip-192-168-147-168.us-west-2.compute.internal NotReady <none> 10s v1.10.3
182+
ip-192-168-102-172.us-west-2.compute.internal NotReady <none> 10s v1.10.3
183+
ip-192-168-223-116.us-west-2.compute.internal Ready <none> 20s v1.10.3
184+
ip-192-168-147-168.us-west-2.compute.internal Ready <none> 20s v1.10.3
185+
ip-192-168-102-172.us-west-2.compute.internal Ready <none> 20s v1.10.3
118186

119187
== Kubernetes Cluster Context
120188

01-path-basics/103-kubernetes-concepts/readme.adoc

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,17 +1209,13 @@ Deleting a job deletes all the pods as well. Delete the job as:
12091209

12101210
=== Prerequisites
12111211

1212-
For Kubernetes cluster versions < 1.8, Cron Job can be created with API version `batch/v2alpha1`. You can check the cluster version using this command,
1212+
For Kubernetes cluster versions < 1.8, Cron Job can be created with API version `batch/v2alpha1`. You need to explicitly enable API version `batch/v2alpha1` in Kubernetes cluster and perform a rolling-update.
12131213

1214-
$ kubectl version
1215-
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.1", GitCommit:"f38e43b221d08850172a9a4ea785a86a3ffa3b3a", GitTreeState:"clean", BuildDate:"2017-10-12T00:45:05Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"darwin/amd64"}
1216-
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.4", GitCommit:"793658f2d7ca7f064d2bdf606519f9fe1229c381", GitTreeState:"clean", BuildDate:"2017-08-17T08:30:51Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
1214+
If you use *Amazon EKS* for provisioning your Kubernetes cluster, your version should be >= v1.10 and you can proceed without any changes. You can check the cluster version using this command,
12171215

1218-
Notice that the server version is at v1.7.4. In this case, you need to explicitly enable API version `batch/v2alpha1` in Kubernetes cluster and perform a rolling-update. These steps are explained in link:../cluster-install#turn-on-an-api-version-for-your-cluster[Turn on an API version for your cluster].
1219-
1220-
NOTE: Once you switch API versions, you need to perform rolling-update of the cluster which generally takes 30 - 45 mins to complete for 3 master nodes and 5 worker nodes cluster.
1221-
1222-
If you have cluster version >= 1.8, `batch/v2alpha1` API is deprecated for this version but you can switch to `batch/v1beta1` to create Cron Jobs
1216+
$ kubectl version
1217+
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-28T20:16:17Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
1218+
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-28T20:13:43Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
12231219

12241220
=== Create Cron Job
12251221

@@ -1578,7 +1574,7 @@ The error message indicates that a ResourceQuota is in effect, and that the Pod
15781574

15791575
Update the configuration file to:
15801576

1581-
$ cat pod-memory.yaml
1577+
$ cat pod-cpu-memory.yaml
15821578
apiVersion: v1
15831579
kind: Pod
15841580
metadata:
@@ -1597,15 +1593,15 @@ Update the configuration file to:
15971593

15981594
There is an explicity memory resource defined here. Now, try to create the pod:
15991595

1600-
$ kubectl apply -f pod-memory.yaml
1596+
$ kubectl apply -f pod-cpu-memory.yaml
16011597
pod "nginx-pod" created
16021598

16031599
The Pod is successfully created.
16041600

16051601
Get more details about the Pod:
16061602

16071603
$ kubectl get pod/nginx-pod -o jsonpath={.spec.containers[].resources}
1608-
map[requests:map[cpu:100m memory:100m]]
1604+
map[requests:map[cpu:1 memory:100m]
16091605

16101606
Get more details about the ResourceQuota:
16111607

01-path-basics/103-kubernetes-concepts/templates/pod-memory.yaml renamed to 01-path-basics/103-kubernetes-concepts/templates/pod-cpu-memory.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ spec:
1111
resources:
1212
requests:
1313
memory: "100m"
14+
cpu: 1
1415
ports:
15-
- containerPort: 80
16+
- containerPort: 80

0 commit comments

Comments
 (0)