Task 03. Run WordPress on kubernetes using Deployment, StatefulSet, Service.
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.
Task
1. Repository
- Fork repository for task03 and clone forked repo.
2. Understand Kubernetes basics.
- Learn about Kubernetes Deployment: read documentation
- Run simple application in deployment from file: Create deployment using yaml file
wordpress_manifest.yaml
, with namesimple-app
that would rundockersamples/static-site
container, has labelapp: simple-app
and has2
replicas, exposed port 80. Apply your changes to kubernetes. And usingkubectl port-forward
command try to open you application in browser. -
Run simple application in deployment using command line: Create deployment using command
kubectl run
, with namesimple-app2
that would rundockersamples/static-site
container, has labelapp: simple-app2
and has2
replicas, exposed port 80. Apply your changes to kubernetes. And usingkubectl port-forward
command try to open you application in browser. - Learn about Kubernetes Service: read documentation
- Expose simple-app pods as one endpoint: After creating and properly configuring service make sure that application is available on this service.
- Clean up: remove created previously deployments and service.
2. Run local MySQL database with StatefulSet.
- Learn about Kubernetes StatefulSet
- Create StatefulSet database: Create statefulSet named
database
, with containermysql
, with labels that you want. Add it todatabase.yaml
file. - Expose database using service. Make sure that MySQL is accessible by port 3306. Add it to
database.yaml
file.
3. Run local WordPress setup in couple pods using Deployment.
- Create Deployment with following parameters:
- deployment name:
wordpress
- replicas:
2
- pods labels
app: wordpress
- use
wordpress
pod manifest from previous task as a template for deployment - save manifest to
wordpress.yaml
file
- deployment name:
- Expose wordpress using service. Make sure that Wordpress blog is accessible by port 80. Add it to
wordpress.yaml
file.
4. Make your work visible.
Create Pull Request with changes on files:
wordpress_manifest.yaml
database.yaml
wordpress.yaml
5. Cleanup created resources
Additional tasks if you feel that it was too easy.
- N/A
Tips:
- N/A
Recommended soft:
- N/A
Useful links:
FAQ
- N/A