Skip to content

Commit

Permalink
add task3 for phase 3
Browse files Browse the repository at this point in the history
  • Loading branch information
korney4eg authored Feb 27, 2024
1 parent d662fdd commit 4111354
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
env
git clone https://github.com/korney4eg/korney4eg.github.io/
cd korney4eg.github.io/
echo $GITHUB_HEAD_REF
git checkout $GITHUB_HEAD_REF
bundle install
echo "I finished"
/change-checker check -c config.yaml -u $GITHUB_HEAD_REF -b master -d
66 changes: 37 additions & 29 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,70 +1,78 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
colorator (1.1.0)
concurrent-ruby (1.1.8)
em-websocket (0.5.2)
concurrent-ruby (1.2.2)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.15.0)
ffi (1.15.5)
forwardable-extended (2.6.0)
http_parser.rb (0.6.0)
i18n (1.8.10)
google-protobuf (3.22.0-arm64-darwin)
google-protobuf (3.22.0-x86_64-darwin)
google-protobuf (3.22.0-x86_64-linux)
http_parser.rb (0.8.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
jekyll (4.2.0)
addressable (~> 2.8)
jekyll (4.3.2)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (~> 2.0)
jekyll-sass-converter (>= 2.0, < 4.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.3)
kramdown (~> 2.3, >= 2.3.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.4.0)
mercenary (>= 0.3.6, < 0.5)
pathutil (~> 0.9)
rouge (~> 3.0)
rouge (>= 3.0, < 5.0)
safe_yaml (~> 1.0)
terminal-table (~> 2.0)
terminal-table (>= 1.8, < 4.0)
webrick (~> 1.7)
jekyll-paginate (1.1.0)
jekyll-sass-converter (2.1.0)
sassc (> 2.0.1, < 3.0)
jekyll-sass-converter (3.0.0)
sass-embedded (~> 1.54)
jekyll-seo-tag (2.7.1)
jekyll (>= 3.8, < 5.0)
jekyll-sitemap (1.4.0)
jekyll (>= 3.7, < 5.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.3.1)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.5.1)
liquid (4.0.4)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.6)
rb-fsevent (0.10.4)
public_suffix (5.0.1)
rake (13.0.6)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
rouge (3.26.0)
rouge (3.30.0)
safe_yaml (1.0.5)
sassc (2.4.0)
ffi (~> 1.9)
terminal-table (2.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
unicode-display_width (1.7.0)
sass-embedded (1.58.3)
google-protobuf (~> 3.21)
rake (>= 10.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.4.2)
webrick (1.8.1)

PLATFORMS
universal-darwin-22
universal-darwin-23
x86_64-linux
x86_64-linux-musl

DEPENDENCIES
jekyll-paginate
Expand Down
3 changes: 2 additions & 1 deletion tasks/_posts/2021-03-01-phase3-task1-start-k8s-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ As a first step, you decided to run Kubernetes locally on your computer.
- **Run pod with nginx container**: Start new pod with nginx container and make sure that it's running.
- **Check logs of nginx container**
- **Make port forwarding of nginx pod**: Try to access nginx inside pod using your web browser and tools provided by Kubernetes.
- ** Check resources used by nginx pod**: Try to find Kubernetes command that will allow you to see resource usage by pod.
- **Check resources used by nginx pod**: Try to find Kubernetes command that will allow you to see resource usage by pod.
- **get information of when did pod started**
- **remove nginx pod**

Expand All @@ -42,6 +42,7 @@ As a first step, you decided to run Kubernetes locally on your computer.
### Useful links:

- [Kubernetes getting started](https://kubernetes.io/docs/setup/)
- [Working with Pods](https://kubernetes.io/docs/concepts/workloads/pods/)

### FAQ

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: Task 03. Run WordPress on kubernetes using Deployment, StatefulSet, Service.
published: true
active: true
tags: "Phase3"
difficulty: 2
---

Now it's time to scale your application to be able to handle load. So you decided to use deployments, services, statefulsets in your blog engine.

<!--more-->

## Task

### 1. Repository

- Fork [repository for task03](https://github.com/learningdevops-makvaz-com/phase03_task03) and clone forked repo.

### 2. Run local WordPress setup in couple pods using Deployment.

{:refdef: style="text-align: center;"}
![Diagramm](assets/ph3_t2_p2.png)
{: refdef}

- Create Deployment with following parameters:
- replicas: `3`
- pods labels `app: wordpress`
- container port should be `80`
- image for wordpress container should be `korney4eg/wordpress-empty:latest`
- pods selector should look for pods labeled `app: wordpress`
- pod name: `wordpress`

- **Run MySQL database inside container `database` in pod `wordpress`**: Update `wordpress_manifest.yaml` so that there would be pod `wordpress` with `database` container that listens on port `3306`. Feel free to hard-code password and other parameters should into manifest. To verify that database is working properly try to run expose database port using `kubectl port-forward` command.
- **Run Wordpress inside container `app` in pod `wordpress`**: Update `wordpress_manifest.yaml` by adding `app` container that listens on port `80` and accessing database by address `localhost:3306`. Use password and other parameters that you configured in previous step.
- **Check that wordpress pod is running**.
- **Clean up**: Run command `kubectl delete -f wordpress_manifest.yaml`.

### 3. Run local MySQL database with StatefulSet.

{:refdef: style="text-align: center;"}
![Diagramm](assets/ph3_t2_p3.png)
{: refdef}

- **Run pod `database` with MySQL database container**: Update `database.yaml` so that there would be pod `database` with `mysql` container that works on port `3306`. Password and other parameters should be hard-coded in manifest.
- **Check that `database` pod is running**. Try to use Kubernetes service.
- **Run pod with Wordpress**: Update `wordpress.yaml` so that there would be pod `wordpress` with `app` container that works on port `80`. Password and other parameters should be hard-coded in manifest. Use `database` pod's address as your database.
- **Check that wordpress pod is running**. Try to use Kubernetes service.
- ** Clean up**: Run command `kubectl delete -f wordpress_manifest.yaml`.

### 4. Run Init container inside WordPress pod.

{:refdef: style="text-align: center;"}
![Diagramm](assets/ph3_t2_p4.png)
{: refdef}

- **Build container with wordpress that doesn't have plugin built it**.
- **Replace container image from `app` container with newly built image**.
- **Run Init container `plugin-download` that downloads plugin**: Before `app` container started we need to have [thank-after-post-plugin](https://github.com/korney4eg/thank-after-post-plugin) to be downloaded by `plugin-download` container and later to be mounted in `app` container. Please update `wordpress.yaml` file for this task.

### 5. Make your work visible.

Create Pull Request with changes on files:

- `wordpress_manifest.yaml`
- `database.yaml`
- `wordpress.yaml`

### Additional tasks if you feel that it was too easy.

1. Resources and limits: Before running any container it's always nice to limit it's resources usage so that it doesn't allocate all of them. Try to use it.
2. Kubernetes has mechanism to check whether container is ready to handle traffic, it's called `readinessProbe`. Try to use it.
3. Kubernetes has mechanism to check whether container is ready to handle traffic, it's called `livenessProbe`. Try to use it.

### Tips:

- _N/A_

### Recommended soft:

- _N/A_

### Useful links:

- [Kuberentes API](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/)
- [Kuberentes Deployments](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/)

### FAQ

- _N/A_
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Task 03. Monitoring kubernetes.
title: Task 09. Monitoring kubernetes.
published: true
active: false
tags: "Phase3"
Expand Down

0 comments on commit 4111354

Please sign in to comment.