|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * post_installation_configuration/cluster-tasks.adoc |
| 4 | + |
| 5 | +ifeval::["{context}" == "installing-aws-localzone"] |
| 6 | +:localzone: |
| 7 | +endif::[] |
| 8 | + |
| 9 | +:_content-type: PROCEDURE |
| 10 | +[id="installation-extend-edge-nodes-aws-local-zones_{context}"] |
| 11 | += Creating user workloads in AWS Local Zones |
| 12 | +After you create an Amazon Web Service (AWS) Local Zone environment, and you deploy your cluster, you can use edge worker nodes to create user workloads in Local Zone subnets. |
| 13 | + |
| 14 | +After the `openshift-installer` creates the cluster, the installation program automatically specifies a taint effect of `NoSchedule` to each edge worker node. This means that a scheduler does not add a new pod, or deployment, to a node if the pod does not match the specified tolerations for a taint. You can modify the taint for better control over how each node creates a workload in each Local Zone subnet. |
| 15 | + |
| 16 | +The `openshift-installer` creates the compute machine set manifests file with `node-role.kubernetes.io/edge` and `node-role.kubernetes.io/worker` labels applied to each edge worker node that is located in a Local Zone subnet. |
| 17 | + |
| 18 | +.Prerequisites |
| 19 | + |
| 20 | +* You have access to the OpenShift CLI (`oc`). |
| 21 | +* You deployed your cluster in a Virtual Private Cloud (VPC) with defined Local Zone subnets. |
| 22 | +* You ensured that the compute machine set for the edge workers on Local Zone subnets specifies the taints for `node-role.kubernetes.io/edge`. |
| 23 | +
|
| 24 | +.Procedure |
| 25 | + |
| 26 | +. Create a `deployment` resource YAML file for an example application to be deployed in the edge worker node that operates in a Local Zone subnet. Ensure that you specify the correct tolerations that match the taints for the edge worker node. |
| 27 | ++ |
| 28 | +.Example of a configured `deployment` resource for an edge worker node that operates in a Local Zone subnet |
| 29 | +[source,yaml] |
| 30 | +---- |
| 31 | +kind: Namespace |
| 32 | +apiVersion: v1 |
| 33 | +metadata: |
| 34 | + name: <local_zone_application_namespace> |
| 35 | +--- |
| 36 | +kind: PersistentVolumeClaim |
| 37 | +apiVersion: v1 |
| 38 | +metadata: |
| 39 | + name: <pvc_name> |
| 40 | + namespace: <local_zone_application_namespace> |
| 41 | +spec: |
| 42 | + accessModes: |
| 43 | + - ReadWriteOnce |
| 44 | + resources: |
| 45 | + requests: |
| 46 | + storage: 10Gi |
| 47 | + storageClassName: gp2-csi <1> |
| 48 | + volumeMode: Filesystem |
| 49 | +--- |
| 50 | +apiVersion: apps/v1 |
| 51 | +kind: Deployment <2> |
| 52 | +metadata: |
| 53 | + name: <local_zone_application> <3> |
| 54 | + namespace: <local_zone_application_namespace> <4> |
| 55 | +spec: |
| 56 | + selector: |
| 57 | + matchLabels: |
| 58 | + app: <local_zone_application> |
| 59 | + replicas: 1 |
| 60 | + template: |
| 61 | + metadata: |
| 62 | + labels: |
| 63 | + app: <local_zone_application> |
| 64 | + zone-group: ${ZONE_GROUP_NAME} <5> |
| 65 | + spec: |
| 66 | + securityContext: |
| 67 | + seccompProfile: |
| 68 | + type: RuntimeDefault |
| 69 | + nodeSelector: <6> |
| 70 | + machine.openshift.io/zone-group: ${ZONE_GROUP_NAME} |
| 71 | + tolerations: <7> |
| 72 | + - key: "node-role.kubernetes.io/edge" |
| 73 | + operator: "Equal" |
| 74 | + value: "" |
| 75 | + effect: "NoSchedule" |
| 76 | + containers: |
| 77 | + - image: openshift/origin-node |
| 78 | + command: |
| 79 | + - "/bin/socat" |
| 80 | + args: |
| 81 | + - TCP4-LISTEN:8080,reuseaddr,fork |
| 82 | + - EXEC:'/bin/bash -c \"printf \\\"HTTP/1.0 200 OK\r\n\r\n\\\"; sed -e \\\"/^\r/q\\\"\"' |
| 83 | + imagePullPolicy: Always |
| 84 | + name: echoserver |
| 85 | + ports: |
| 86 | + - containerPort: 8080 |
| 87 | + volumeMounts: |
| 88 | + - mountPath: "/mnt/storage" |
| 89 | + name: data |
| 90 | + volumes: |
| 91 | + - name: data |
| 92 | + persistentVolumeClaim: |
| 93 | + claimName: <pvc_name> |
| 94 | +---- |
| 95 | +<1> `storageClassName`: For the Local Zone configuration, you must specify `gp2-csi`. |
| 96 | +<2> `kind`: Defines the `deployment` resource. |
| 97 | +<3> `name`: Specifies the name of your Local Zone application. For example, `local-zone-demo-app-nyc-1`. |
| 98 | +<4> `namespace:` Defines the namespace for the AWS Local Zone where you want to run the user workload. For example: `local-zone-app-nyc-1a`. |
| 99 | +<5> `zone-group`: Defines the group to where a zone belongs. For example, `us-east-1-iah-1`. |
| 100 | +<6> `nodeSelector`: Targets edge worker nodes that match the specified labels. |
| 101 | +<7> `tolerations`: Sets the values that match with the `taints` defined on the `MachineSet` manifest for the Local Zone node. |
| 102 | + |
| 103 | +. Create a `service` resource YAML file for the node. This resource exposes a pod from a targeted edge worker node to services that run inside your Local Zone network. |
| 104 | ++ |
| 105 | +.Example of a configured `service` resource for an edge worker node that operates in a Local Zone subnet |
| 106 | +[source,yaml] |
| 107 | +---- |
| 108 | +apiVersion: v1 |
| 109 | +kind: Service <1> |
| 110 | +metadata: |
| 111 | + name: <local_zone_application> |
| 112 | + namespace: <local_zone_application_namespace> |
| 113 | +spec: |
| 114 | + ports: |
| 115 | + - port: 80 |
| 116 | + targetPort: 8080 |
| 117 | + protocol: TCP |
| 118 | + type: NodePort |
| 119 | + selector: <2> |
| 120 | + app: <local_zone_application> |
| 121 | +---- |
| 122 | +<1> `kind`: Defines the `service` resource. |
| 123 | +<2> `selector:` Specifies the label type applied to managed pods. |
0 commit comments