Add Circle CI questions

In addition to a couple of k8s questions.
This commit is contained in:
abregman
2022-10-16 23:17:47 +03:00
parent 64e6614680
commit ad66a50f3a
9 changed files with 307 additions and 9 deletions

View File

@@ -0,0 +1,12 @@
# Node Selectors
## Objectives
1. Apply the label "hw=max" on one of the nodes in your cluster
2. Create and run a Pod called `some-pod` with the image `redis` and configure it to use the selector `hw=max`
3. Explain why node selectors might be limited
## Solution
Click [here](solution.md) to view the solution

View File

@@ -0,0 +1,29 @@
# Node Selectors
## Objectives
1. Apply the label "hw=max" on one of the nodes in your cluster
2. Create and run a Pod called `some-pod` with the image `redis` and configure it to use the selector `hw=max`
3. Explain why node selectors might be limited
## Solution
Click [here](solution.md) to view the solution
1. `kubectl label nodes some-node hw=max`
2.
```
kubectl run some-pod --image=redis --dry-run=client -o yaml > pod.yaml
vi pod.yaml
spec:
nodeSelector:
hw: max
kubectl apply -f pod.yaml
```
3. Assume you would like to run your Pod on all the nodes with with either `hw` set to max or to min, instead of just max. This is not possible with nodeSelectors which are quite simplified and this is where you might want to consider `node affinity`.

View File

@@ -6,12 +6,8 @@
2. Create a taint on one of the nodes in your cluster with key of "app" and value of "web" and effect of "NoSchedule"
1. Explain what it does exactly
2. Verify it was applied
3. Run a Pod that will be able to run on the node on which you applied the taint
## Solution
Click [here](solution.md) to view the solution.
1. `kubectl describe no minikube | grep -i taints`
2. `kubectl taint node minikube app=web:NoSchedule`
1. Any resource with "app=web" key value will not be scheduled on node `minikube`
2. `kubectl describe no minikube | grep -i taints`
Click [here](solution.md) to view the solution.

View File

@@ -0,0 +1,30 @@
# Taints 101
## Objectives
1. Check if one of the nodes in the cluster has taints (doesn't matter which node)
2. Create a taint on one of the nodes in your cluster with key of "app" and value of "web" and effect of "NoSchedule"
1. Explain what it does exactly
2. Verify it was applied
## Solution
1. `kubectl describe no minikube | grep -i taints`
2. `kubectl taint node minikube app=web:NoSchedule`
1. Any resource with "app=web" key value will not be scheduled on node `minikube`
2. `kubectl describe no minikube | grep -i taints`
3.
```
kubectl run some-pod --image=redis
kubectl edit po some-pod
```
```
- effect: NoSchedule
key: app
operator: Equal
value: web
```
Save and exit. The Pod should be running.