Skip to content

Commit

Permalink
lecture05 Updated documentation and finished exercises
Browse files Browse the repository at this point in the history
  • Loading branch information
Svane20 committed Aug 27, 2024
1 parent 4b52706 commit 6243121
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 27 deletions.
12 changes: 10 additions & 2 deletions lectures/02/exercises.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ To clean up the resources created in this lecture, you can follow the steps belo
1. `kubectl delete -f datanodes.yaml`
1. `kubectl delete -f namenode.yaml`
1. `kubectl delete -f configmap.yaml`
1. `kubectl delete pvc hadoop-datanode-storage-datanode-0 \
hadoop-datanode-storage-datanode-1 \
hadoop-datanode-storage-datanode-2 \
hadoop-namenode-storage-namenode-0
`
- cd into the `services/interactive` folder in the repository.
1. `kubectl delete -f interactive.yaml`

Expand All @@ -274,6 +279,9 @@ To begin with, we will delete the first hello-kubernetes deployment that you mad
- Next we will uninstall the hello-kubernetes release of the hello-kubernetes Helm chart: `helm uninstall hello-kubernetes-helm`
- Delete the ubuntu container: `kubectl delete pods/ubuntu`

You can get a list of the pods and services to verify that they are deleted.
You can get a list of the resources to verify that they are deleted.
- `kubectl get pods`
- `kubectl get services`
- `kubectl get services`
- `kubectl get deployments`
- `kubectl get configmap`
- `kubectl get pvc`
18 changes: 15 additions & 3 deletions lectures/03/exercises.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ To clean up the resources created in this lecture, you can follow the steps belo
- Todays exercises.
1. `kubectl delete -f sqoop.yaml`
1. `helm delete postgresql`
1. `kubectl delete pvc data-postgresql-0`
1. `kubectl delete pod python`
1. `kubectl delete -f flume.yaml`
1. `kubectl delete -f redpanda.yaml`
Expand All @@ -589,15 +590,26 @@ To clean up the resources created in this lecture, you can follow the steps belo
1. `kubectl delete -f kafka-ksqldb.yaml`
1. `kubectl delete pod kafka-client`
1. `helm delete kafka`
1. `kubectl delete pvc data-kafka-controller-0 \
data-kafka-controller-1 \
data-kafka-controller-2
`
- `cd` into the `services/hdfs` folder in the repository.
1. `kubectl delete -f datanodes.yaml`
1. `kubectl delete -f namenode.yaml`
1. `kubectl delete -f configmap.yaml`
1. `kubectl delete -f pvc.yaml`
1. `kubectl delete pvc hadoop-datanode-storage-datanode-0 \
hadoop-datanode-storage-datanode-1 \
hadoop-datanode-storage-datanode-2 \
hadoop-namenode-storage-namenode-0
`
- `cd` into the `services/interactive` folder in the repository.
1. `kubectl delete -f interactive.yaml`
You can get a list of the pods and services to verify that they are deleted.
You can get a list of the resources to verify that they are deleted.
- `kubectl get pods`
- `kubectl get services`
- `kubectl get services`
- `kubectl get deployments`
- `kubectl get configmap`
- `kubectl get pvc`
67 changes: 45 additions & 22 deletions lectures/05/exercises.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,24 +315,9 @@ We will be working with MongoDB which is great for storing JSON like records wit

**Note:** We will deploying the minimum configuration for this database in order to reduce the recoruse footprint.

This exercise is composed of three parts starting wiht a deployment of the MongoDB cluster. Then we would like to revist Kafka Connect similar to [Exercise 06](./../03/exercises.md#exercise-6---kafka-connect-and-hdfs) from lecture 3. And finally we will look into querying JSON records in the database.
This exercise is composed of three parts starting with a deployment of the MongoDB cluster. Then we would like to revist Kafka Connect similar to [Exercise 06](./../03/exercises.md#exercise-6---kafka-connect-and-hdfs) from lecture 3. And finally we will look into querying JSON records in the database.


We recommand to create a isolated namespace for the following MongoDB services.

**Task:** Create a namepsace in Kubernetes called `mongodb`.
<details>
<summary><strong>Hint:</strong> Create namespace</summary>

```
kubectl create namespace mongodb
```

</details>



The [mongodb.yaml](mongodb.yaml) contains a complete manifest to compose a MongoDB cluster. The manifest includes the following recources:
The [mongodb.yaml](./mongodb.yaml) contains a complete manifest to compose a MongoDB cluster. The manifest includes the following recources:
- PersistentVolumeClaim: `mongodb-pvc`
- Services
- `mongodb`
Expand All @@ -345,8 +330,8 @@ The [mongodb.yaml](mongodb.yaml) contains a complete manifest to compose a Mongo
- `mongodb`
- `mongo-express`

**Task:** Familize yourself with the [mongodb.yaml](mongodb.yaml) manifest.
**Note:** Our example includes a simple authentication mecanishm. The username and password have been hardcoded into the [mongodb.yaml](mongodb.yaml) file. We do encurge you to apply a more sufisticated approach when you transfering into a production environment.
**Task:** Familiarize yourself with the [mongodb.yaml](mongodb.yaml) manifest.
**Note:** Our example includes a simple authentication mechanism. The username and password have been hardcoded into the [mongodb.yaml](mongodb.yaml) file. We do encurge you to apply a more sufisticated approach when you transfering into a production environment.


**Task:** Apply the [mongodb.yaml](mongodb.yaml) manifest to compose the MongoDB cluster.
Expand All @@ -370,7 +355,7 @@ One approach for getting the current state of the deployed resources is by using


```
kubectl get all -n mongodb
kubectl get all
```
You should expect a similar output like the chunk below:

Expand Down Expand Up @@ -409,7 +394,7 @@ The web-based `mongo-express` interface requires port-forwarding to access the s
<summary><strong>Hint:</strong> Get all the resources inside the `mongodb` namespace</summary>

```
kubectl port-forward svc/mongo-express 8084:8084 -n mongodb
kubectl port-forward svc/mongo-express 8084:8084
```
</details>

Expand All @@ -434,7 +419,7 @@ Similar to the web-based approach you need to set up port-forwarding to reach th
<summary><strong>Hint:</strong> Get all the resources inside the `mongodb` namespace</summary>

```
kubectl port-forward svc/mongodb 27017:27017 -n mongodb
kubectl port-forward svc/mongodb 27017:27017
```
</details>

Expand Down Expand Up @@ -585,3 +570,41 @@ Because the redis cluster has replicas, then if a primary node fails, then a rep
You should see that you are still able to get the key even though the primary node was killed. This is very cool 😎.

**Task:** What tactics does Redis Cluster + Redis Sentinel use?

To clean up the resources created in this lecture, you can follow the steps below:
- Todays exercises.
1. `kubectl delete pod redis-cluster-client`
1. `helm uninstall redis`
1. `kubectl delete pvc redis-data-redis-redis-cluster-0 \
redis-data-redis-redis-cluster-1 \
redis-data-redis-redis-cluster-2 \
redis-data-redis-redis-cluster-3 \
redis-data-redis-redis-cluster-4 \
redis-data-redis-redis-cluster-5
`
1. `helm uninstall trino`
1. `kubectl delete -f hive-metastore.yaml`
1. `helm uninstall postgresql`
1. `helm uninstall minio`
1. `kubectl delete pvc data-postgresql-0 minio-data-minio-0`
- `cd` into the `lecture/03` folder in the repository.
1. `kubectl delete -f redpanda.yaml`
1. `kubectl delete -f kafka-schema-registry.yaml`
1. `kubectl delete -f kafka-connect.yaml`
1. `kubectl delete -f kafka-ksqldb.yaml`
1. `kubectl delete pod kafka-client`
1. `helm uninstall kafka`
1. `kubectl delete pvc data-kafka-controller-0 \
data-kafka-controller-1 \
data-kafka-controller-2
`
- `cd` into the `services/interactive` folder in the repository.
1. `kubectl delete -f interactive.yaml`


You can get a list of the resources to verify that they are deleted.
- `kubectl get pods`
- `kubectl get services`
- `kubectl get deployments`
- `kubectl get configmap`
- `kubectl get pvc`
99 changes: 99 additions & 0 deletions lectures/05/mongodb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
apiVersion: "v1"
kind: "PersistentVolumeClaim"
metadata:
name: "mongodb-pvc"
labels:
app: "mongodb"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
---
apiVersion: "v1"
kind: "Service"
metadata:
name: "mongodb"
spec:
type: "NodePort"
ports:
- port: 27017
targetPort: 27017
selector:
app: "mongodb"
---
apiVersion: "apps/v1"
kind: "Deployment"
metadata:
name: "mongodb"
spec:
selector:
matchLabels:
app: "mongodb"
replicas: 1
template:
metadata:
labels:
app: "mongodb"
spec:
containers:
- name: "mongodb"
image: "mongo"
imagePullPolicy: "Always"
env:
- name: "MONGO_INITDB_ROOT_USERNAME"
value: "admin"
- name: "MONGO_INITDB_ROOT_PASSWORD"
value: "password"
- name: "MONGO_ROOT_USERNAME"
value: "admin"
- name: "MONGO_ROOT_PASSWORD"
value: "password"
ports:
- containerPort: 27017
---
apiVersion: "v1"
kind: "Service"
metadata:
name: "mongo-express"
spec:
type: "NodePort"
ports:
- port: 8084
targetPort: 8081
selector:
app: "mongo-express"
---
apiVersion: "apps/v1"
kind: "Deployment"
metadata:
name: "mongo-express"
spec:
selector:
matchLabels:
app: "mongo-express"
replicas: 1
template:
metadata:
labels:
app: "mongo-express"
spec:
containers:
- name: "mongo-express"
image: "mongo-express"
imagePullPolicy: "Always"
env:
- name: "MONGO_ROOT_USERNAME"
value: "admin"
- name: "MONGO_ROOT_PASSWORD"
value: "password"
- name: "ME_CONFIG_MONGODB_ADMINUSERNAME"
value: "admin"
- name: "ME_CONFIG_MONGODB_ADMINPASSWORD"
value: "password"
- name: "ME_CONFIG_MONGODB_URL"
value: "mongodb://admin:password@mongodb:27017"
ports:
- containerPort: 8081

0 comments on commit 6243121

Please sign in to comment.