Skip to content

Commit

Permalink
Merge pull request #96 from linode/APL-456
Browse files Browse the repository at this point in the history
fix: network policy lab
  • Loading branch information
CasLubbers authored Dec 23, 2024
2 parents be73f3d + efe878e commit bca49be
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions docs/get-started/labs/create-netpols.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The egress rules are namespace wide. You cannot bind an egress policy to one Wor

### Build Images for the Application

Build the `Vote`, `Worker` and `Result` images from this [repo](https://github.com/linode/apl-example-app). Use the Build feature to build the images with `mode: Docker`. Set the `path` to `./vote/Dockerfile` for the Vote image (and `./worker/Dockerfile` for the Worker and `./result/Dockerfile` for Result).
Build the `vote`, `worker` and `result` images from this [repo](https://github.com/linode/apl-example-app). Use the Build feature to build the images with `mode: Docker`. Set the `path` to `./vote/Dockerfile` for the Vote image (and `./worker/Dockerfile` for the Worker and `./result/Dockerfile` for Result).

### Create a Redis Cluster and a PostgreSQL Database

Expand All @@ -86,6 +86,7 @@ containerPorts:
env:
- name: REDIS_HOST
value: <redis-cluster-name>-master
replicaCount: 1
```
### Deploy the Worker App
Expand Down Expand Up @@ -114,8 +115,13 @@ env:
value: <redis-cluster-name>-master
- name: DATABASE_HOST
value: <psql-cluster-name>-rw
replicaCount: 1
```

:::note
The worker pod will show an error “Waiting for db” in the logs. This is an expected error that will be resolved when all the steps in the lab are done.
:::

### Deploy the Result App

Use the `k8s-deployment` chart to deploy the result app. Use the following values:
Expand All @@ -140,7 +146,13 @@ env:
key: password
- name: DATABASE_HOST
value: <psql-cluster-name>-rw
- name: DATABASE_NAME
value: <psql-cluster-name>
replicaCount: 1
```
:::note
The result pod will show an error “Waiting for db” in the logs. This is an expected error that will be resolved when all the steps in the lab are done.
:::

### Register Services for Exposure

Expand All @@ -151,38 +163,38 @@ env:

#### Result

- Register the `<result>` service.
- Register the `result` service.
- Set exposure to `External`.

### Create the Network Policies for the Example Voting App

#### Postgres Database

1. Create a new `Netpol` and select the `ingress` rule type.
1. Create a new `Network policy` and select the `ingress` rule type.

2. Add the selector label name `otomi.io/app`.

3. Add the selector label value `<postgres-workload-name>`.

4. Select `AllowOnly`.

5. Add the namespace `<team-name>`, the selector label name `otomi.io/app` and the selector label value `<worker>`.
5. Add the namespace `team-<name>`, the selector label name `otomi.io/app` and the selector label value `worker`.

6. Add the namespace `<team-name>`, the selector label name `otomi.io/app` and the selector label value `<result>`.
6. Add the namespace `team-<name>`, the selector label name `otomi.io/app` and the selector label value `result`.

#### Redis

1. Create a new `Netpol` and select the `ingress` rule type.
1. Create a new `Network policy` and select the `ingress` rule type.

2. Add the selector label name `otomi.io/app`.

3. Add the selector label value `<redis-workload-name>`.

4. Select `AllowOnly`.

5. Add the namespace `<team-name>`, the selector label name `otomi.io/app` and the selector label value `<worker>`.
5. Add the namespace `team-<name>`, the selector label name `otomi.io/app` and the selector label value `worker`.

6. Add the namespace `<team-name>`, the selector label name `otomi.io/app` and the selector label value `<vote>`.
6. Add the namespace `team-<name>`, the selector label name `otomi.io/app` and the selector label value `vote`.

### Test the Voting App

Expand Down

0 comments on commit bca49be

Please sign in to comment.