# Part 1: Provision

## What Will You Do

In this part of the self-paced exercise, you will provision an Amazon EKS cluster which contains two (2) managed nodes groups. The first managed node group will be comprised of Linux on-demand compute instances and run the system level resources while the second managed node group will be comprised of Windows instances and run application workloads. The cluster will use the minimal blueprint.

---

## Step 1: Provision Cluster

In this step, we will provision an EKS cluster through the web console. We will first deploy the cluster with a single node group for system level resources. We will then add the Windows node group to the cluster.

- Navigate to the "defaultproject" project in your Org
- Select Infrastructure -> Clusters
- Click "New Cluster"
- Select "Create a New Cluster"
- Click "Continue"

- Select "Public Cloud"
- Select "AWS"
- Select "Amazon EKS"
- Enter a cluster name
- Click "Continue"

- Select a previously created Cloud Credential
- Select the AWS Region for the cluster
- Click "Save Changes"

- Click "Edit" on the "Node Group Settings" section
- Enter a node group name for the system resources node group
- Select "Managed Node Group"
- Select "Custom" for "Instance Type"
- Enter "t3.large" for the "Custom Instance Type"
- Set the "Desired Nodes" to "1"
- Set the "Nodes Min" to "1"

- Click "Add Key-Value Label" in the "Labels" subsection
- Enter "nodes" for the Key
- Enter "system" for the Value

- Click "Add Taint" in the "Taints" subsection
- Click "Create Key-Value-Effect Taint"
- Enter "components" for the Key
- Enter "system" for the Value
- Select "NoSchedule" for the Effect
- Click "Save"

- Expand the "System Components Placement" section
- Click "Add Toleration"
- Click "Create Key-Value-Effect Toleration"
- Enter "components" for the Key
- Enter "system" for the Value
- Select "NoSchedule" for the Effect
- Click "Save"

- Click "Add Key-Value Node Selector" in the "Node Selectors" subsection
- Enter "nodes" for the Key
- Enter "system" for the Value
- Click "Save Changes"

- Click "Provision"

---

## Step 2: Add Windows Node Group

In this step, we will add a Windows node group to the cluster through the web console.

- Add the below node group configuration to the "managedNodeGroups" section of the "eks-windows-cluster.yaml" file that was previously saved.

- Login to the web console

- Navigate to your project
- Select Infrastructure -> Clusters
- Click the Windows cluster name
- Click "Node Groups" tab

You can see the windows node group creating

After a few minutes, the Windows node group finishes provisioning. You can see the node group is using the Windows Server AMI.

---

## Step 3: Verify Cluster

Once provisioning is complete, you should see the cluster in the web console with two nodes.

- Click on the kubectl link and type the following command

```
kubectl get nodes -o wide
```

You should see output similar to the following showing the Linux and Windows nodes.

```
NAME                                           STATUS   ROLES    AGE   VERSION               INTERNAL-IP      EXTERNAL-IP      OS-IMAGE                         KERNEL-VERSION                 CONTAINER-RUNTIME
ip-192-168-58-114.us-west-2.compute.internal   Ready    <none>   80m   v1.24.7-eks-fb459a0   192.168.58.114   35.92.212.8      Amazon Linux 2                   5.4.226-129.415.amzn2.x86_64   containerd://1.6.6
ip-192-168-80-118.us-west-2.compute.internal   Ready    <none>   30m   v1.24.7-eks-fb459a0   192.168.80.118   44.234.144.188   Windows Server 2019 Datacenter   10.0.17763.3887                containerd://1.6.6
```

Now we will verify the system resources are running on the on-demand Linux node group.

- Click "Nodes" in the tree at the top of the page to return to the nodes tab
- Locate the "Node ID" of the node in the "managed-system" node group

- Click on the "Resources" tab
- Click on "Pods" in the left side window
- Select "rafay-system" from the namespace drop down menu
- Click the gear icon on the right side of the page and select "Node"

You will see that all of the system components are running on the "managed-system" node that was previously identified.

---

## Step 4: Create Namespace

In this step, we will create a namespace using the web console. The namespace will be used to deploy workloads in future steps.

- Navigate to the project in your Org where the cluster is located.
- Select Infrastructure -> Namespaces
- Click "New Namespace"
- Enter "windows" for the name
- Select "Wizard" for the Type
- Click "Save"

- Click "Save & Go To Placement"

- Select the cluster to create the namespace on
- Click "Save & Go To Publish"

- Click "Publish"

The namespace is now published on the cluster.

- Click "Exit"

---

## Step 5: Enable Windows Support

In this step, we will create a YAML based workload and publish the workload to the cluster. The workload will create a configmap to enable Windows Support on the cluster.

By default, the amazon-vpc-cni doesn't have Windows support enabled, and to deploy Windows pods so it can have its own VPC IP, we need to enable it in the EKS control plane. To do this, we will create a configmap in the cluster.

- Navigate to the project in your Org where the cluster is located.
- Select Applications -> Workloads
- Click New Workload -> Create New Workload
- Enter a Name for the Workload
- Select "k8s YAML" for the Package Type
- Select "Upload files manually"
- Select the namespace that was previously created
- Click "Continue"

- Save the following YAML to a file

```
apiVersion: v1
kind: ConfigMap
metadata:
  name: amazon-vpc-cni
  namespace: kube-system
data:
  enable-windows-ipam: "true"
```

- Click "Choose File" to select the saved YAML file
- Click "Save and Go To Placement"

- Select the cluster where the namespace was created
- Click "Save and Go To Publish"

- Click "Publish"

The YAML workload is now published on the cluster.

- Click "Exit"

- Click on the kubectl link for the cluster and type the following command

```
kubectl get configmap -n kube-system
```

You should see output showing the "amazon-vpc-cni".

```text
NAME                                 DATA   AGE
amazon-vpc-cni                       1      2m4s
aws-auth                             1      141m
coredns                              1      147m
cp-vpc-resource-controller           0      147m
eks-certificates-controller          0      147m
extension-apiserver-authentication   6      147m
kube-proxy                           1      147m
kube-proxy-config                    1      147m
kube-root-ca.crt                     1      147m
```

---

## Recap

Congratulations! At this point, you have successfully provisioned an Amazon EKS cluster with a managed Windows node group in your AWS account.
