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 #13

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:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: app
operator: In
values:
- mysql
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- mysql
topologyKey: "kubernetes.io/hostname"
volumeClaimTemplates:
- metadata:
name: data
Expand Down
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,43 @@ 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.


## How to Validate the Changes

### Create Kubernetes Cluster

`kind create cluster --config=cluster.yml`

### Run Bootstrap Script

`./bootstrap.sh`


### Verify the Deployment

Check the list of pods

`kubectl get pods -n todoapp`


### Checking Resource Scheduling and Allocation

Verify Pod Scheduling

`kubectl get pods -o wide -n todoapp`


Get Pod Details

`kubectl describe pod <pod_name>`


### Node Affinity and Taints Verification

Check Node Affinity

`kubectl get nodes --show-labels`



1 change: 1 addition & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
kubectl taint nodes -l app=mysql app=mysql:NoSchedule
kubectl apply -f .infrastructure/mysql/ns.yml
kubectl apply -f .infrastructure/mysql/configMap.yml
kubectl apply -f .infrastructure/mysql/secret.yml
Expand Down