|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * post_installation_configuration/configuring-aws-outposts.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="aws-outposts-load-balancer-clb_{context}"] |
| 7 | += Using AWS Classic Load Balancers in an AWS VPC cluster extended into an Outpost |
| 8 | + |
| 9 | +AWS Outposts racks cannot run AWS Classic Load Balancers, but Classic Load Balancers in the AWS VPC cluster can target edge compute nodes in the Outpost if edge and cloud-based subnets are in the same availability zone. |
| 10 | +As a result, Classic Load Balancers on the VPC cluster might schedule pods on either of these node types. |
| 11 | + |
| 12 | +Scheduling the workloads on edge compute nodes is supported, but can introduce latency. |
| 13 | +If you want to prevent a Classic Load Balancer in the VPC cluster from targeting Outpost edge compute nodes, you can apply labels to the cloud-based compute nodes and configure the Classic Load Balancer to only schedule on nodes with the applied labels. |
| 14 | + |
| 15 | +[NOTE] |
| 16 | +==== |
| 17 | +If you do not need to prevent a Classic Load Balancer in the VPC cluster from targeting Outpost edge compute nodes, you do not need to complete these steps. |
| 18 | +==== |
| 19 | + |
| 20 | +.Prerequisites |
| 21 | + |
| 22 | +* You have extended an AWS VPC cluster into an Outpost. |
| 23 | +
|
| 24 | +* You have access to the cluster using an account with `cluster-admin` permissions. |
| 25 | +
|
| 26 | +* You have installed the {oc-first}. |
| 27 | +
|
| 28 | +* You have created a user workload in the Outpost with tolerations that match the taints for your edge compute machines. |
| 29 | +
|
| 30 | +.Procedure |
| 31 | + |
| 32 | +. Optional: Verify that the edge compute nodes have the `location=outposts` label by running the following command and verifying that the output includes only the edge compute nodes in your Outpost: |
| 33 | ++ |
| 34 | +[source,terminal] |
| 35 | +---- |
| 36 | +$ oc get nodes -l location=outposts |
| 37 | +---- |
| 38 | + |
| 39 | +. Label the cloud-based compute nodes in the VPC cluster with a key-value pair by running the following command: |
| 40 | ++ |
| 41 | +[source,terminal] |
| 42 | +---- |
| 43 | +$ for NODE in $(oc get node -l node-role.kubernetes.io/worker --no-headers | grep -v outposts | awk '{print$1}'); do oc label node $NODE <key_name>=<value>; done |
| 44 | +---- |
| 45 | ++ |
| 46 | +where `<key_name>=<value>` is the label you want to use to distinguish cloud-based compute nodes. |
| 47 | ++ |
| 48 | +.Example output |
| 49 | +[source,text] |
| 50 | +---- |
| 51 | +node1.example.com labeled |
| 52 | +node2.example.com labeled |
| 53 | +node3.example.com labeled |
| 54 | +---- |
| 55 | + |
| 56 | +. Optional: Verify that the cloud-based compute nodes have the specified label by running the following command and confirming that the output includes all cloud-based compute nodes in your VPC cluster: |
| 57 | ++ |
| 58 | +[source,terminal] |
| 59 | +---- |
| 60 | +$ oc get nodes -l <key_name>=<value> |
| 61 | +---- |
| 62 | ++ |
| 63 | +.Example output |
| 64 | +[source,terminal] |
| 65 | +---- |
| 66 | +NAME STATUS ROLES AGE VERSION |
| 67 | +node1.example.com Ready worker 7h v1.28.5 |
| 68 | +node2.example.com Ready worker 7h v1.28.5 |
| 69 | +node3.example.com Ready worker 7h v1.28.5 |
| 70 | +---- |
| 71 | + |
| 72 | +. Configure the Classic Load Balancer service by adding the cloud-based subnet information to the `annotations` field of the `Service` manifest: |
| 73 | ++ |
| 74 | +.Example service configuration |
| 75 | +[source,yaml] |
| 76 | +---- |
| 77 | +apiVersion: v1 |
| 78 | +kind: Service |
| 79 | +metadata: |
| 80 | + labels: |
| 81 | + app: <application_name> |
| 82 | + name: <application_name> |
| 83 | + namespace: <application_namespace> |
| 84 | + annotations: |
| 85 | + service.beta.kubernetes.io/aws-load-balancer-subnets: <aws_subnet> # <1> |
| 86 | + service.beta.kubernetes.io/aws-load-balancer-target-node-labels: <key_name>=<value> # <2> |
| 87 | +spec: |
| 88 | + ports: |
| 89 | + - name: http |
| 90 | + port: 80 |
| 91 | + protocol: TCP |
| 92 | + targetPort: 8080 |
| 93 | + selector: |
| 94 | + app: <application_name> |
| 95 | + type: LoadBalancer |
| 96 | +---- |
| 97 | +<1> Specify the subnet ID for the AWS VPC cluster. |
| 98 | +<2> Specify the key-value pair that matches the pair in the node label. |
| 99 | + |
| 100 | +. Create the `Service` CR by running the following command: |
| 101 | ++ |
| 102 | +[source,terminal] |
| 103 | +---- |
| 104 | +$ oc create -f <file_name>.yaml |
| 105 | +---- |
| 106 | + |
| 107 | +.Verification |
| 108 | + |
| 109 | +. Verify the status of the `service` resource to show the host of the provisioned Classic Load Balancer by running the following command: |
| 110 | ++ |
| 111 | +[source,terminal] |
| 112 | +---- |
| 113 | +$ HOST=$(oc get service <application_name> -n <application_namespace> --template='{{(index .status.loadBalancer.ingress 0).hostname}}') |
| 114 | +---- |
| 115 | + |
| 116 | +. Verify the status of the provisioned Classic Load Balancer host by running the following command: |
| 117 | ++ |
| 118 | +[source,terminal] |
| 119 | +---- |
| 120 | +$ curl $HOST |
| 121 | +---- |
| 122 | + |
| 123 | +. In the AWS console, verify that only the labeled instances appear as the targeted instances for the load balancer. |
0 commit comments