Skip to content

Commit

Permalink
Add GitHub markup
Browse files Browse the repository at this point in the history
  • Loading branch information
bmuschko committed Feb 7, 2024
1 parent de51605 commit c487e88
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 20 deletions.
2 changes: 1 addition & 1 deletion exercises/01-container/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</p>
</details>

In this exercise, you will practice building a container image from an existing `Dockerfile`. Then you will run the container from the image, and interact with it. You can use a container runtime engine of your choice, e.g. [Docker Engine](https://docs.docker.com/engine/), [containerd](https://containerd.io/).
In this exercise, you will practice building a container image from an existing `Dockerfile`. Then you will run the container from the image, and interact with it. You can use a container runtime engine of your choice, e.g. [Docker Engine](https://docs.docker.com/engine/), [Podman](https://podman.io/).

1. Inspect the [`Dockerfile`](./app/Dockerfile) in the `app` directory.
2. Build the container image from the `Dockerfile` with the tag `nodejs-hello-world:1.0.0`.
Expand Down
3 changes: 2 additions & 1 deletion exercises/02-pod/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

In this exercise, you will practice the creation of a new Pod in a namespace. Once created, you will inspect it, shell into it and run some operations inside of the container.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating and interacting with a Pod"](https://learning.oreilly.com/scenarios/ckad-pods-creating/9781098104818/).
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating and interacting with a Pod"](https://learning.oreilly.com/scenarios/ckad-pods-creating/9781098104818/).
1. Create the namespace `ckad-prep`.
2. In the namespace `ckad-prep`, create a new Pod named `mypod` with the image `nginx:2.3.5`. Expose the port 80.
Expand Down
3 changes: 2 additions & 1 deletion exercises/04-cronjob/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

In this exercise, you will create a CronJob and render its executions.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a CronJob"](https://learning.oreilly.com/scenarios/ckad-jobs-creating/9781098105297/).
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a CronJob"](https://learning.oreilly.com/scenarios/ckad-jobs-creating/9781098105297/).
1. Create a CronJob named `current-date` that runs every minute and executes the shell command `echo "Current date: $(date)"`.
2. Watch the jobs as they are being scheduled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

In this exercise, you will create a PersistentVolume, connect it to a PersistentVolumeClaim and mount the claim to a specific path of a Pod.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a Pod with Volume of type PersistentVolume with static binding"](https://learning.oreilly.com/scenarios/ckad-volumes-creating/9781098105365/).
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a Pod with Volume of type PersistentVolume with static binding"](https://learning.oreilly.com/scenarios/ckad-volumes-creating/9781098105365/).
1. Create a PersistentVolume named `pv`, access mode `ReadWriteMany`, 512Mi of storage capacity and the host path `/data/config`.
2. Create a PersistentVolumeClaim named `pvc`. The claim should request 256Mi and use an empty string value for the storage class. Ensure that the PersistentVolumeClaim is properly bound after its creation.
Expand Down
3 changes: 2 additions & 1 deletion exercises/07-init-container/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

Kubernetes runs an init container before the main container. In this lab, the init container retrieves configuration files from a remote location and makes it available to the application running in the main container. The configuration files are shared through a volume mounted by both containers. The running application consumes the configuration files and can render its values.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating an init container"](https://learning.oreilly.com/scenarios/ckad-multi-container-creating/9781098104986/).
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating an init container"](https://learning.oreilly.com/scenarios/ckad-multi-container-creating/9781098104986/).
1. Create a new Pod in a YAML file named `business-app.yaml`. The Pod should define two containers, one init container and one main application container. Name the init container `configurer` and the main container `web`. The init container uses the image `busybox`, the main container uses the image `bmuschko/nodejs-read-config:1.0.0`. Expose the main container on port 8080.
2. Edit the YAML file by adding a new volume of type `emptyDir` that is mounted at `/usr/shared/app` for both containers.
Expand Down
3 changes: 2 additions & 1 deletion exercises/08-adapter-pattern/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

The adapter pattern helps with providing a simplified, homogenized view of an application running within a container. For example, we could stand up another container that unifies the log output of the application container. As a result, other monitoring tools can rely on a standardized view of the log output without having to transform it into an expected format.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a sidecar container"](https://learning.oreilly.com/scenarios/ckad-multi-container-creating/9781098104993/).
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a sidecar container"](https://learning.oreilly.com/scenarios/ckad-multi-container-creating/9781098104993/).
1. Create a new Pod in a YAML file named `adapter.yaml`. The Pod declares two containers. The container `app` uses the image `busybox` and runs the command `while true; do echo "$(date) | $(du -sh ~)" >> /var/logs/diskspace.txt; sleep 5; done;`. The adapter container `transformer` uses the image `busybox` and runs the command `sleep 20; while true; do while read LINE; do echo "$LINE" | cut -f2 -d"|" >> $(date +%Y-%m-%d-%H-%M-%S)-transformed.txt; done < /var/logs/diskspace.txt; sleep 20; done;` to strip the log output off the date for later consumption by a monitoring tool. Be aware that the logic does not handle corner cases (e.g. automatically deleting old entries) and would look different in production systems.
2. Before creating the Pod, define an `emptyDir` volume. Mount the volume in both containers with the path `/var/logs`.
Expand Down
3 changes: 2 additions & 1 deletion exercises/09-ambassador-pattern/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ In this example, you'll be asked to implement rate-limiting functionality for HT

The image `bmuschko/nodejs-business-app:1.0.0` represents a Node.js-based application that makes a call to localhost on port 8081. The ambassador container represented by the image `bmuschko/nodejs-ambassador:1.0.0` running on port 8081 will take on making the HTTP call to the external service while at the same time enforcing rate limiting.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Implementing the Ambassador Pattern"](https://www.katacoda.com/orm-benjamin-muschko/courses/ckad-assessment/ambassador-pattern/).
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Implementing the Ambassador Pattern"](https://www.katacoda.com/orm-benjamin-muschko/courses/ckad-assessment/ambassador-pattern/).
1. Create a YAML manifest for a Pod with the name `rate-limiter` in the namespace `ext-access`. Store the definition in the file named `rate-limiter.yaml`. The main application container named `business-app` should use the image `bmuschko/nodejs-business-app:1.0.0` and expose the container port 8080.
2. Modify the YAML manifest by adding the ambassador container named `ambassador`. The ambassador container uses the image `bmuschko/nodejs-ambassador:1.0.0` and exposes the container port 8081.
Expand Down
3 changes: 2 additions & 1 deletion exercises/10-labels-annotations-cli/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

In this exercise, you will exercise assigning labels and annotations to a set of Pods. Moreover, you will use `kubectl` to query for Pods based on different requirements.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive labs ["Assigning labels to Pods imperatively"](https://learning.oreilly.com/scenarios/ckad-labels-assigning/9781098105181/) and ["Assigning annotations to Pods imperatively"](https://learning.oreilly.com/scenarios/ckad-annotations-assigning/9781098105204/).
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive labs ["Assigning labels to Pods imperatively"](https://learning.oreilly.com/scenarios/ckad-labels-assigning/9781098105181/) and ["Assigning annotations to Pods imperatively"](https://learning.oreilly.com/scenarios/ckad-annotations-assigning/9781098105204/).
1. Create three different Pods with the names `frontend`, `backend` and `database` that use the image `nginx`. For convenience, you can use the file [`pods.yaml`](./pods.yaml) to create the Pods.
2. Declare labels for those Pods, as follows:
Expand Down
3 changes: 2 additions & 1 deletion exercises/11-deployment-rolling-update/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

In this exercise, you will create a Deployment with multiple replicas. After inspecting the Deployment, you will update its Pod template. Furthermore, you will use the rollout history to roll back to a previous revision.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive labs ["Creating and Manually Scaling a Deployment"](https://learning.oreilly.com/scenarios/ckad-deployments-creating/9781098105235/) and ["Rolling Out a New Revision for a Deployment"](https://learning.oreilly.com/scenarios/ckad-deployments-rolling/9781098105242/).
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive labs ["Creating and Manually Scaling a Deployment"](https://learning.oreilly.com/scenarios/ckad-deployments-creating/9781098105235/) and ["Rolling Out a New Revision for a Deployment"](https://learning.oreilly.com/scenarios/ckad-deployments-rolling/9781098105242/).
1. Create a Deployment named `nginx` with 3 replicas. The Pods should use the `nginx:1.23.0` image and the name `nginx`. The Deployment uses the label `tier=backend`. The Pod template should use the label `app=v1`.
2. List the Deployment and ensure that the correct number of replicas is running.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
</p>
</details>

> **_NOTE:_** You will need to install the metrics server if you want actual resource metrics to be collected and displayed by the HorizontalPodAutoscaler. You can find [installation instructions](https://github.com/kubernetes-sigs/metrics-server#installation) on the project's GitHub page.
> [!NOTE]
> You will need to install the metrics server if you want actual resource metrics to be collected and displayed by the HorizontalPodAutoscaler. You can find [installation instructions](https://github.com/kubernetes-sigs/metrics-server#installation) on the project's GitHub page.
1. Create a Deployment named `nginx` with 1 replica. The Pod template of the Deployment should use container image `nginx:1.23.4`, set the CPU resource request to 0.5, and the memory resource request/limit to 500Mi.
2. Create a HorizontalPodAutoscaler for the Deployment named `nginx-hpa` that scales to minium of 3 and a maximum of 8 replicas. Scaling should happen based on an average CPU utilization of 75%, and an average memory utilization of 60%.
Expand Down
3 changes: 2 additions & 1 deletion exercises/14-helm-consume-chart/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

In this exercise, you use Helm to install Kubernetes objects needed for the open source monitoring solution [Prometheus](https://prometheus.io/). The easiest way to install Prometheus on top of Kubernetes is with the help of the [prometheus-operator](https://prometheus-operator.dev/) Helm chart.

> **_NOTE:_** You will need to have Helm installed on your machine. The Helm documentation page provides detailed, OS-specific [installation instructions](https://helm.sh/docs/intro/install/).
> [!NOTE]
> You will need to have Helm installed on your machine. The Helm documentation page provides detailed, OS-specific [installation instructions](https://helm.sh/docs/intro/install/).
1. The Prometheus Helm charts reside in the [artifact repository](https://prometheus-community.github.io/helm-charts). Add the repository to the list of known repositories accessible by Helm with the name `prometheus-community`.
2. Update to the latest information about charts from the respective chart repository.
Expand Down
3 changes: 2 additions & 1 deletion exercises/17-pod-probes/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

In this exercise, you will create a Pod running a NodeJS application. The Pod will define readiness and liveness probes with different parameters.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a Pod with a readiness Probe of type HTTP GET request"](https://learning.oreilly.com/scenarios/ckad-probing-creating/9781098105105/).
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a Pod with a readiness Probe of type HTTP GET request"](https://learning.oreilly.com/scenarios/ckad-probing-creating/9781098105105/).
1. Create a new Pod named `hello` with the image `bmuschko/nodejs-hello-world:1.0.0` that exposes the port 3000. Provide the name `nodejs-port` for the container port.
2. Add a Readiness Probe that checks the URL path / on the port referenced with the name `nodejs-port` after a 2 seconds delay. You do not have to define the period interval.
Expand Down
3 changes: 2 additions & 1 deletion exercises/18-pod-metrics/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
</p>
</details>

> **_NOTE:_** You will need to install the metrics server if you want to be able to inspect actual resource metrics. You can find [installation instructions](https://github.com/kubernetes-sigs/metrics-server#installation) on the project's GitHub page.
> [!NOTE]
> You will need to install the metrics server if you want to be able to inspect actual resource metrics. You can find [installation instructions](https://github.com/kubernetes-sigs/metrics-server#installation) on the project's GitHub page.
1. Create the namespace `stress-test`.
2. The current directory contains the YAML manifests for three Pods, [`stress-1-pod.yaml`](./stress-1-pod.yaml), [`stress-2-pod.yaml`](./stress-2-pod.yaml), and [`stress-3-pod.yaml`](./stress-3-pod.yaml). Create all of them.
Expand Down
3 changes: 2 additions & 1 deletion exercises/23-resourcequota/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

In this exercise, you will create a ResourceQuota with specific CPU and memory limits for a new namespace. Pods created in the namespace will have to adhere to those limits.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a resource quota for a number of Secrets"](https://learning.oreilly.com/scenarios/ckad-security-creating/9781098104955/).
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a resource quota for a number of Secrets"](https://learning.oreilly.com/scenarios/ckad-security-creating/9781098104955/).
Create a resource quota named `app` under the namespace `rq-demo` using the following YAML definition in the file [`resourcequota.yaml`](./resourcequota.yaml).

Expand Down
3 changes: 2 additions & 1 deletion exercises/25-configmap/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

In this exercise, you will first create a ConfigMap from a YAML configuration file as a source. Later, you'll create a Pod, consume the ConfigMap as Volume and inspect the key-value pairs as files.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a ConfigMap and consuming it as environment variables"](https://learning.oreilly.com/scenarios/ckad-configuration-creating/9781098104917/).
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a ConfigMap and consuming it as environment variables"](https://learning.oreilly.com/scenarios/ckad-configuration-creating/9781098104917/).
1. Inspect the YAML configuration file named [`application.yaml`](./application.yaml).
2. Create a new ConfigMap named `app-config` from that file.
Expand Down
3 changes: 2 additions & 1 deletion exercises/26-secret/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

In this exercise, you will first create a Secret from literal values. Next, you'll create a Pod and consume the Secret as environment variables. Finally, you'll print out its values from within the container.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a Secret and consuming it as environment variables"](https://learning.oreilly.com/scenarios/ckad-configuration-creating/9781098104894/).
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Creating a Secret and consuming it as environment variables"](https://learning.oreilly.com/scenarios/ckad-configuration-creating/9781098104894/).
1. Create a new Secret named `db-credentials` with the key/value pair `db-password=passwd`.
2. Create a Pod named `backend` that uses the Secret as environment variable named `DB_PASSWORD` and runs the container with the image `nginx:1.23.4-alpine`.
Expand Down
3 changes: 2 additions & 1 deletion exercises/27-securitycontext/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

In this exercise, you will create a Pod that defines a security context with different options.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Defining a security context"](https://learning.oreilly.com/scenarios/ckad-security-defining/9781098104948/).
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive lab ["Defining a security context"](https://learning.oreilly.com/scenarios/ckad-security-defining/9781098104948/).
1. Define a Pod named `busybox-security-context` that uses the image `busybox:1.28` for a single container running the command `sh -c sleep 1h`.
2. Add an ephemeral Volume of type `emptyDir`. Mount the Volume to the container at `/data/test`.
Expand Down
6 changes: 5 additions & 1 deletion exercises/28-service/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

In this exercise, you will create a Deployment and expose a container port for its Pods. You will demonstrate the differences between the service types ClusterIP and NodePort.

> **_NOTE:_** If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive labs ["Creating a Service of type ClusterIP"](https://learning.oreilly.com/scenarios/ckad-services-creating/9781098105310/) and ["Creating a Service of type NodePort"](https://learning.oreilly.com/scenarios/ckad-services-creating/9781098105327/). If you are using minikube, the network is limited if using the Docker driver on Darwin, Windows, or WSL, and the Node IP is not reachable directly. Refer to the [documentation](https://minikube.sigs.k8s.io/docs/handbook/accessing/) to gain access to the minikube IP.
> [!NOTE]
> If you do not already have a cluster, you can create one by using minikube or you can use the O'Reilly interactive labs ["Creating a Service of type ClusterIP"](https://learning.oreilly.com/scenarios/ckad-services-creating/9781098105310/) and ["Creating a Service of type NodePort"](https://learning.oreilly.com/scenarios/ckad-services-creating/9781098105327/).
> [!IMPORTANT]
> If you are using minikube, the network is limited if using the Docker driver on Darwin, Windows, or WSL, and the Node IP is not reachable directly. Refer to the [documentation](https://minikube.sigs.k8s.io/docs/handbook/accessing/) to gain access to the minikube IP.
1. Create a Service named `myapp` of type `ClusterIP` that exposes port 80 and maps to the target port 80.
2. Create a Deployment named `myapp` that creates 1 replica running the image `nginx:1.23.4-alpine`. Expose the container port 80.
Expand Down

0 comments on commit c487e88

Please sign in to comment.