Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #25

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .infrastructure/app/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,23 @@ spec:
secretName: app-secret
- name: app-config-volume
configMap:
name: app-config
name: app-config
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: app
operator: In
values:
- todoapp
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- todoapp
topologyKey: "kubernetes.io/hostname"
23 changes: 23 additions & 0 deletions .infrastructure/mysql/statefulSet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,29 @@ spec:
- name: config-map
configMap:
name: mysql
tolerations:
- key: "app"
operator: "Equal"
value: "mysql"
effect: "NoSchedule"
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- mysql
topologyKey: "kubernetes.io/hostname"
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: app
operator: In
values:
- mysql
volumeClaimTemplates:
- metadata:
name: data
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,13 @@ Create a kubernetes manifest for a pod which will containa ToDo app container:
1. `bootstrap.sh` should containe all the commands to deploy all the required resources in the cluster
1. `README.md` should have instructuions on how to validate the changes
1. Create PR with your changes and attach it for validation on a platform.

To validate the changes use next command:

kubectl get pods -o wide -n mysql

in result you can see that pod mysql run in nodes with mysql label, each in different nodes.

kubectl get pods -o wide -n todoapp

and also just for pods todoapp