|
| 1 | +:_mod-docs-content-type: ASSEMBLY |
| 2 | +[id="learning-lab-overview"] |
| 3 | += Workshop overview |
| 4 | +include::_attributes/attributes-openshift-dedicated.adoc[] |
| 5 | +:context: learning-lab-overview |
| 6 | +toc::[] |
| 7 | + |
| 8 | +//rosaworkshop.io content metadata |
| 9 | +//Brought into ROSA product docs 22-JAN-2024 |
| 10 | +//Modified for HCP 15 October 2024 |
| 11 | + |
| 12 | +== Introduction |
| 13 | + |
| 14 | +After successfully provisioning your cluster, follow this workshop to deploy an application on it to understand the concepts of deploying and operating container-based applications. |
| 15 | + |
| 16 | +.Workshop objectives |
| 17 | + |
| 18 | +* Deploy a Node.js-based application by using Source-to-Image (S2I) and Kubernetes deployment objects |
| 19 | +* Set up a continuous delivery (CD) pipeline to automatically push source code changes |
| 20 | +* Experience self-healing applications |
| 21 | +* Explore configuration management through ConfigMaps, secrets, and environment variables |
| 22 | +* Use persistent storage to share data across pod restarts |
| 23 | +* Explore networking in Kubernetes and applications |
| 24 | +* Familiarize yourself with ROSA and Kubernetes functionality |
| 25 | +* Automatically scale pods based on loads from the Horizontal Pod Autoscaler (HPA) |
| 26 | +//* Use AWS Controllers for Kubernetes (ACK) to deploy and use an S3 bucket |
| 27 | + |
| 28 | +.Prerequisites |
| 29 | + |
| 30 | +* A provisioned ROSA cluster |
| 31 | +* The link:https://docs.openshift.com/rosa/cli_reference/openshift_cli/getting-started-cli.html[OpenShift command line interface (CLI)] |
| 32 | +* A link:https://github.com/signup[GitHub account] |
| 33 | + |
| 34 | +== About the OSToy application |
| 35 | + |
| 36 | +OSToy is a Node.js application that deploys to a ROSA cluster to help explore the functionality of Kubernetes. |
| 37 | + |
| 38 | +This application has a user interface where you can: |
| 39 | + |
| 40 | +* Write messages to the log (stdout / stderr) |
| 41 | +* Intentionally crash the application to view self-healing |
| 42 | +* Toggle a liveness probe and monitor OpenShift behavior |
| 43 | +* Read ConfigMaps, secrets, and environment variables |
| 44 | +* Read and write files when connected to shared storage |
| 45 | +* Check network connectivity, intra-cluster DNS, and intra-communication with the included microservice |
| 46 | +* Increase the load to view automatic scaling of the pods by using the HPA |
| 47 | +//* Connect to an AWS S3 bucket to read and write objects |
| 48 | + |
| 49 | +=== OSToy Application Diagram |
| 50 | + |
| 51 | +image::ostoy-arch.png[OSToy architecture diagram] |
| 52 | + |
| 53 | +=== Understanding the OSToy UI |
| 54 | + |
| 55 | +image::ostoy-homepage.png[Preview of the OSToy homepage] |
| 56 | + |
| 57 | +. Pod name |
| 58 | +. *Home:* Application home page |
| 59 | +. *Persistent Storage:* Writes data to the persistent volume bound to the application |
| 60 | +. *Config Maps:* Shows ConfigMaps available to the application and the key:value pairs |
| 61 | +. *Secrets:* Shows secrets available to the application and the key:value pairs |
| 62 | +. *ENV Variables:* Shows environment variables available to the application |
| 63 | +. *Networking:* Networking tools |
| 64 | +. *Pod Auto Scaling:* Increase the load of the pods and test the Horizontal Pod Autoscaler (HPA) |
| 65 | +. *ACK S3:* Integrate with AWS S3 to read and write objects to a bucket |
| 66 | ++ |
| 67 | +. *About:* Application information |
| 68 | + |
| 69 | +=== Lab resources |
| 70 | + |
| 71 | +* link:https://github.com/openshift-cs/ostoy[OSToy application source code] |
| 72 | +* link:https://quay.io/ostoylab/ostoy-frontend[OSToy front-end container image] |
| 73 | +* link:https://quay.io/ostoylab/ostoy-microservice[OSToy microservice container image] |
| 74 | +* Deployment definition YAML files: |
| 75 | ++ |
| 76 | +.`ostoy-frontend-deployment.yaml` |
| 77 | ++ |
| 78 | +[source,yaml] |
| 79 | +---- |
| 80 | +apiVersion: v1 |
| 81 | +kind: PersistentVolumeClaim |
| 82 | +metadata: |
| 83 | + name: ostoy-pvc |
| 84 | +spec: |
| 85 | + accessModes: |
| 86 | + - ReadWriteOnce |
| 87 | + resources: |
| 88 | + requests: |
| 89 | + storage: 1Gi |
| 90 | +--- |
| 91 | +apiVersion: apps/v1 |
| 92 | +kind: Deployment |
| 93 | +metadata: |
| 94 | + name: ostoy-frontend |
| 95 | + labels: |
| 96 | + app: ostoy |
| 97 | +spec: |
| 98 | + selector: |
| 99 | + matchLabels: |
| 100 | + app: ostoy-frontend |
| 101 | + strategy: |
| 102 | + type: Recreate |
| 103 | + replicas: 1 |
| 104 | + template: |
| 105 | + metadata: |
| 106 | + labels: |
| 107 | + app: ostoy-frontend |
| 108 | + spec: |
| 109 | + # Uncomment to use with ACK portion of the workshop |
| 110 | + # If you chose a different service account name please replace it. |
| 111 | + # serviceAccount: ostoy-sa |
| 112 | + containers: |
| 113 | + - name: ostoy-frontend |
| 114 | + securityContext: |
| 115 | + allowPrivilegeEscalation: false |
| 116 | + runAsNonRoot: true |
| 117 | + seccompProfile: |
| 118 | + type: RuntimeDefault |
| 119 | + capabilities: |
| 120 | + drop: |
| 121 | + - ALL |
| 122 | + image: quay.io/ostoylab/ostoy-frontend:1.6.0 |
| 123 | + imagePullPolicy: IfNotPresent |
| 124 | + ports: |
| 125 | + - name: ostoy-port |
| 126 | + containerPort: 8080 |
| 127 | + resources: |
| 128 | + requests: |
| 129 | + memory: "256Mi" |
| 130 | + cpu: "100m" |
| 131 | + limits: |
| 132 | + memory: "512Mi" |
| 133 | + cpu: "200m" |
| 134 | + volumeMounts: |
| 135 | + - name: configvol |
| 136 | + mountPath: /var/config |
| 137 | + - name: secretvol |
| 138 | + mountPath: /var/secret |
| 139 | + - name: datavol |
| 140 | + mountPath: /var/demo_files |
| 141 | + livenessProbe: |
| 142 | + httpGet: |
| 143 | + path: /health |
| 144 | + port: 8080 |
| 145 | + initialDelaySeconds: 10 |
| 146 | + periodSeconds: 5 |
| 147 | + env: |
| 148 | + - name: ENV_TOY_SECRET |
| 149 | + valueFrom: |
| 150 | + secretKeyRef: |
| 151 | + name: ostoy-secret-env |
| 152 | + key: ENV_TOY_SECRET |
| 153 | + - name: MICROSERVICE_NAME |
| 154 | + value: OSTOY_MICROSERVICE_SVC |
| 155 | + - name: NAMESPACE |
| 156 | + valueFrom: |
| 157 | + fieldRef: |
| 158 | + fieldPath: metadata.namespace |
| 159 | + volumes: |
| 160 | + - name: configvol |
| 161 | + configMap: |
| 162 | + name: ostoy-configmap-files |
| 163 | + - name: secretvol |
| 164 | + secret: |
| 165 | + defaultMode: 420 |
| 166 | + secretName: ostoy-secret |
| 167 | + - name: datavol |
| 168 | + persistentVolumeClaim: |
| 169 | + claimName: ostoy-pvc |
| 170 | +--- |
| 171 | +apiVersion: v1 |
| 172 | +kind: Service |
| 173 | +metadata: |
| 174 | + name: ostoy-frontend-svc |
| 175 | + labels: |
| 176 | + app: ostoy-frontend |
| 177 | +spec: |
| 178 | + type: ClusterIP |
| 179 | + ports: |
| 180 | + - port: 8080 |
| 181 | + targetPort: ostoy-port |
| 182 | + protocol: TCP |
| 183 | + name: ostoy |
| 184 | + selector: |
| 185 | + app: ostoy-frontend |
| 186 | +--- |
| 187 | +apiVersion: route.openshift.io/v1 |
| 188 | +kind: Route |
| 189 | +metadata: |
| 190 | + name: ostoy-route |
| 191 | +spec: |
| 192 | + to: |
| 193 | + kind: Service |
| 194 | + name: ostoy-frontend-svc |
| 195 | +--- |
| 196 | +apiVersion: v1 |
| 197 | +kind: Secret |
| 198 | +metadata: |
| 199 | + name: ostoy-secret-env |
| 200 | +type: Opaque |
| 201 | +data: |
| 202 | + ENV_TOY_SECRET: VGhpcyBpcyBhIHRlc3Q= |
| 203 | +--- |
| 204 | +kind: ConfigMap |
| 205 | +apiVersion: v1 |
| 206 | +metadata: |
| 207 | + name: ostoy-configmap-files |
| 208 | +data: |
| 209 | + config.json: '{ "default": "123" }' |
| 210 | +--- |
| 211 | +apiVersion: v1 |
| 212 | +kind: Secret |
| 213 | +metadata: |
| 214 | + name: ostoy-secret |
| 215 | +data: |
| 216 | + secret.txt: VVNFUk5BTUU9bXlfdXNlcgpQQVNTV09SRD1AT3RCbCVYQXAhIzYzMlk1RndDQE1UUWsKU01UUD1sb2NhbGhvc3QKU01UUF9QT1JUPTI1 |
| 217 | +type: Opaque |
| 218 | +---- |
| 219 | ++ |
| 220 | +.`ostoy-microservice-deployment.yaml` |
| 221 | ++ |
| 222 | +[source,yaml] |
| 223 | +---- |
| 224 | +apiVersion: apps/v1 |
| 225 | +kind: Deployment |
| 226 | +metadata: |
| 227 | + name: ostoy-microservice |
| 228 | + labels: |
| 229 | + app: ostoy |
| 230 | +spec: |
| 231 | + selector: |
| 232 | + matchLabels: |
| 233 | + app: ostoy-microservice |
| 234 | + replicas: 1 |
| 235 | + template: |
| 236 | + metadata: |
| 237 | + labels: |
| 238 | + app: ostoy-microservice |
| 239 | + spec: |
| 240 | + containers: |
| 241 | + - name: ostoy-microservice |
| 242 | + securityContext: |
| 243 | + allowPrivilegeEscalation: false |
| 244 | + runAsNonRoot: true |
| 245 | + seccompProfile: |
| 246 | + type: RuntimeDefault |
| 247 | + capabilities: |
| 248 | + drop: |
| 249 | + - ALL |
| 250 | + image: quay.io/ostoylab/ostoy-microservice:1.5.0 |
| 251 | + imagePullPolicy: IfNotPresent |
| 252 | + ports: |
| 253 | + - containerPort: 8080 |
| 254 | + protocol: TCP |
| 255 | + resources: |
| 256 | + requests: |
| 257 | + memory: "128Mi" |
| 258 | + cpu: "50m" |
| 259 | + limits: |
| 260 | + memory: "256Mi" |
| 261 | + cpu: "100m" |
| 262 | +--- |
| 263 | +apiVersion: v1 |
| 264 | +kind: Service |
| 265 | +metadata: |
| 266 | + name: ostoy-microservice-svc |
| 267 | + labels: |
| 268 | + app: ostoy-microservice |
| 269 | +spec: |
| 270 | + type: ClusterIP |
| 271 | + ports: |
| 272 | + - port: 8080 |
| 273 | + targetPort: 8080 |
| 274 | + protocol: TCP |
| 275 | + selector: |
| 276 | + app: ostoy-microservice |
| 277 | +---- |
| 278 | +* S3 bucket manifest for ACK S3 |
| 279 | ++ |
| 280 | +.`s3-bucket.yaml` |
| 281 | ++ |
| 282 | +[source,yaml] |
| 283 | +---- |
| 284 | +apiVersion: s3.services.k8s.aws/v1alpha1 |
| 285 | +kind: Bucket |
| 286 | +metadata: |
| 287 | + name: ostoy-bucket |
| 288 | + namespace: ostoy |
| 289 | +spec: |
| 290 | + name: ostoy-bucket |
| 291 | +---- |
| 292 | + |
| 293 | +[NOTE] |
| 294 | +==== |
| 295 | +To simplify deployment of the OSToy application, all of the objects required in the above deployment manifests are grouped together. For a typical enterprise deployment, a separate manifest file for each Kubernetes object is recommended. |
| 296 | +==== |
0 commit comments