You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Circle CI](https://circleci.com): "CircleCI is a continuous integration and continuous delivery platform that can be used to implement DevOps practices."
11
+
</b></details>
12
+
13
+
<details>
14
+
<summary>What are some benefits of Circle CI?</summary><br><b>
15
+
16
+
[Circle CI Docs](https://circleci.com/docs/about-circleci): "SSH into any job to debug your build issues.
17
+
Set up parallelism in your .circleci/config.yml file to run jobs faster.
18
+
Configure caching with two simple keys to reuse data from previous jobs in your workflow.
19
+
Configure self-hosted runners for unique platform support.
20
+
Access Arm resources for the machine executor.
21
+
Use orbs, reusable packages of configuration, to integrate with third parties.
22
+
Use pre-built Docker images in a variety of languages.
23
+
Use the API
24
+
to retrieve information about jobs and workflows.
25
+
Use the CLI to access advanced tools locally.
26
+
Get flaky test detection with test insights."
27
+
</b></details>
28
+
29
+
30
+
<details>
31
+
<summary>What is an Orb?</summary><br><b>
32
+
33
+
[Circle CI Docs](https://circleci.com/developer/orbs): "Orbs are shareable packages of CircleCI configuration you can use to simplify your builds"
34
+
35
+
They can come from the public registry or defined privately as part of an organization.
36
+
</b></details>
37
+
38
+
### Circle CI Hands-On 101
39
+
40
+
<details>
41
+
<summary>Where (in what location in the project) Circle CI pipelines are defined?</summary><br><b>
Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pending" state.
538
540
</b></details>
539
541
542
+
### Node Affinity
543
+
544
+
<details>
545
+
<summary>Using node affinity, set a Pod to schedule on a node where the key is "region" and value is either "asia" or "emea"</summary><br><b>
546
+
547
+
`vi pod.yaml`
548
+
549
+
```yaml
550
+
affinity:
551
+
nodeAffinity:
552
+
requiredDuringSchedlingIgnoredDuringExecution:
553
+
nodeSelectorTerms:
554
+
- matchExpressions:
555
+
- key: region
556
+
operator: In
557
+
values:
558
+
- asia
559
+
- emea
560
+
```
561
+
</b></details>
562
+
563
+
<details>
564
+
<summary>Using node affinity, set a Pod to never schedule on a node where the key is "region" and value is "neverland"</summary><br><b>
565
+
566
+
`vi pod.yaml`
567
+
568
+
```yaml
569
+
affinity:
570
+
nodeAffinity:
571
+
requiredDuringSchedlingIgnoredDuringExecution:
572
+
nodeSelectorTerms:
573
+
- matchExpressions:
574
+
- key: region
575
+
operator: NotIn
576
+
values:
577
+
- neverland
578
+
```
579
+
</b></details>
580
+
540
581
## Labels and Selectors
541
582
542
583
<details>
@@ -557,6 +598,38 @@ Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pendin
557
598
`k get deploy -l env=prod,type=web`
558
599
</b></details>
559
600
601
+
### Node Selector
602
+
603
+
<details>
604
+
<summary>Apply the label "hw=max" on one of the nodes in your cluster</summary><br><b>
605
+
606
+
`kubectl label nodes some-node hw=max`
607
+
608
+
</b></details>
609
+
610
+
<details>
611
+
<summary>reate and run a Pod called `some-pod` with the image `redis` and configure it to use the selector `hw=max`</summary><br><b>
612
+
613
+
```
614
+
kubectl run some-pod --image=redis --dry-run=client -o yaml > pod.yaml
615
+
616
+
vi pod.yaml
617
+
618
+
spec:
619
+
nodeSelector:
620
+
hw: max
621
+
622
+
kubectl apply -f pod.yaml
623
+
```
624
+
625
+
</b></details>
626
+
627
+
<details>
628
+
<summary>Explain why node selectors might be limited</summary><br><b>
629
+
630
+
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`.
631
+
</b></details>
632
+
560
633
## Taints
561
634
562
635
<details>
@@ -566,7 +639,36 @@ Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pendin
566
639
</b></details>
567
640
568
641
<details>
569
-
<summary>Create a taint on one of the nodes in your cluster with key of "app" and value of "web" and effect of "NoSchedule"</summary><br><b>
642
+
<summary>Create a taint on one of the nodes in your cluster with key of "app" and value of "web" and effect of "NoSchedule". Verify it was applied</summary><br><b>
570
643
571
644
`k taint node minikube app=web:NoSchedule`
645
+
646
+
`k describe no minikube | grep -i taints`
647
+
</b></details>
648
+
649
+
<details>
650
+
<summary>You applied a taint with <code>k taint node minikube app=web:NoSchedule</code> on the only node in your cluster and then executed <code>kubectl run some-pod --image=redis</code>. What will happen?</summary><br><b>
651
+
652
+
The Pod will remain in "Pending" status due to the only node in the cluster having a taint of "app=web".
653
+
</b></details>
654
+
655
+
<details>
656
+
<summary>You applied a taint with <code>k taint node minikube app=web:NoSchedule</code> on the only node in your cluster and then executed <code>kubectl run some-pod --image=redis</code> but the Pod is in pending state. How to fix it?</summary><br><b>
657
+
658
+
`kubectl edit po some-pod` and add the following
659
+
660
+
```
661
+
- effect: NoSchedule
662
+
key: app
663
+
operator: Equal
664
+
value: web
665
+
```
666
+
667
+
Exit and save. The pod should be in Running state now.
668
+
</b></details>
669
+
670
+
<details>
671
+
<summary>Remove an existing taint from one of the nodes in your cluster</summary><br><b>
Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pending" state.
2476
2479
</b></details>
2477
2480
2481
+
#### Node Affinity
2482
+
2483
+
<details>
2484
+
<summary>Using node affinity, set a Pod to schedule on a node where the key is "region" and value is either "asia" or "emea"</summary><br><b>
2485
+
2486
+
`vi pod.yaml`
2487
+
2488
+
```yaml
2489
+
affinity:
2490
+
nodeAffinity:
2491
+
requiredDuringSchedlingIgnoredDuringExecution:
2492
+
nodeSelectorTerms:
2493
+
- matchExpressions:
2494
+
- key: region
2495
+
operator: In
2496
+
values:
2497
+
- asia
2498
+
- emea
2499
+
```
2500
+
</b></details>
2501
+
2502
+
<details>
2503
+
<summary>Using node affinity, set a Pod to never schedule on a node where the key is "region" and value is "neverland"</summary><br><b>
2504
+
2505
+
`vi pod.yaml`
2506
+
2507
+
```yaml
2508
+
affinity:
2509
+
nodeAffinity:
2510
+
requiredDuringSchedlingIgnoredDuringExecution:
2511
+
nodeSelectorTerms:
2512
+
- matchExpressions:
2513
+
- key: region
2514
+
operator: NotIn
2515
+
values:
2516
+
- neverland
2517
+
```
2518
+
</b></details>
2519
+
2520
+
<details>
2521
+
<summary>True of False? Using the node affinity type "requiredDuringSchedlingIgnoredDuringExecution" means the scheduler can't schedule unless the rule is met</summary><br><b>
2522
+
2523
+
True
2524
+
</b></details>
2525
+
2526
+
<details>
2527
+
<summary>True of False? Using the node affinity type "preferredDuringSchedlingIgnoredDuringExecution" means the scheduler can't schedule unless the rule is met</summary><br><b>
2528
+
2529
+
False. The scheduler tries to find a node that meets the requirements/rules and if it doesn't it will schedule the Pod anyway.
2530
+
</b></details>
2531
+
2478
2532
## Taints
2479
2533
2480
2534
<details>
@@ -2484,9 +2538,38 @@ Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pendin
2484
2538
</b></details>
2485
2539
2486
2540
<details>
2487
-
<summary>Create a taint on one of the nodes in your cluster with key of "app" and value of "web" and effect of "NoSchedule"</summary><br><b>
2541
+
<summary>Create a taint on one of the nodes in your cluster with key of "app" and value of "web" and effect of "NoSchedule". Verify it was applied</summary><br><b>
2488
2542
2489
2543
`k taint node minikube app=web:NoSchedule`
2544
+
2545
+
`k describe no minikube | grep -i taints`
2546
+
</b></details>
2547
+
2548
+
<details>
2549
+
<summary>You applied a taint with <code>k taint node minikube app=web:NoSchedule</code> on the only node in your cluster and then executed <code>kubectl run some-pod --image=redis</code>. What will happen?</summary><br><b>
2550
+
2551
+
The Pod will remain in "Pending" status due to the only node in the cluster having a taint of "app=web".
2552
+
</b></details>
2553
+
2554
+
<details>
2555
+
<summary>You applied a taint with <code>k taint node minikube app=web:NoSchedule</code> on the only node in your cluster and then executed <code>kubectl run some-pod --image=redis</code> but the Pod is in pending state. How to fix it?</summary><br><b>
2556
+
2557
+
`kubectl edit po some-pod`and add the following
2558
+
2559
+
```
2560
+
- effect: NoSchedule
2561
+
key: app
2562
+
operator: Equal
2563
+
value: web
2564
+
```
2565
+
2566
+
Exit and save. The pod should be in Running state now.
2567
+
</b></details>
2568
+
2569
+
<details>
2570
+
<summary>Remove an existing taint from one of the nodes in your cluster</summary><br><b>
1. Apply the label "hw=max" on one of the nodes in your cluster
6
+
2. Create and run a Pod called `some-pod` with the image `redis` and configure it to use the selector `hw=max`
7
+
3. Explain why node selectors might be limited
8
+
9
+
10
+
## Solution
11
+
12
+
Click [here](solution.md) to view the solution
13
+
14
+
1.`kubectl label nodes some-node hw=max`
15
+
2.
16
+
17
+
```
18
+
kubectl run some-pod --image=redis --dry-run=client -o yaml > pod.yaml
19
+
20
+
vi pod.yaml
21
+
22
+
spec:
23
+
nodeSelector:
24
+
hw: max
25
+
26
+
kubectl apply -f pod.yaml
27
+
```
28
+
29
+
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`.
0 commit comments