Skip to content

Commit ad66a50

Browse files
author
abregman
committed
Add Circle CI questions
In addition to a couple of k8s questions.
1 parent 64e6614 commit ad66a50

File tree

9 files changed

+307
-9
lines changed

9 files changed

+307
-9
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@
7777
<td align="center"><a href="topics/perl/README.md"><img src="images/perl.png" width="75px;" height="75px;" alt="perl"/><br /><b>Perl</b></a></td>
7878
</tr>
7979
<tr>
80-
<td align="center"><a href="topics/kafka/README.md"><img src="images/logos/kafka.png" width="70px;" height="80px;" alt="Kafka"/><br /><b>Kafka</b></a></td>
80+
<td align="center"><a href="topics/circleci/README.md"><img src="images/logos/circleci.png" width="70px;" height="70px;" alt="Circle CI"/><br /><b>Circle CI</b></a></td>
8181
<td align="center"><a href="topics/argo/README.md"><img src="images/logos/argo.png" width="80px;" height="80px;" alt="Argo"/><br /><b>Argo</b></a></td>
82+
<td align="center"><a href="topics/kafka/README.md"><img src="images/logos/kafka.png" width="70px;" height="80px;" alt="Kafka"/><br /><b>Kafka</b></a></td>
83+
8284
</tr>
8385
</table>
8486
</center>

images/logos/circleci.png

2.62 KB
Loading

topics/circleci/README.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Circle CI
2+
3+
## Circle CI Questions
4+
5+
### Circle CI 101
6+
7+
<details>
8+
<summary>What is Circle CI?</summary><br><b>
9+
10+
[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>
42+
43+
`.circleci/config.yml`
44+
</b></details>

topics/kubernetes/CKA.md

+103-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
- [Deployments](#deployments)
1313
- [Troubleshooting Deployments](#troubleshooting-deployments)
1414
- [Scheduler](#scheduler)
15+
- [Node Affinity](#node-affinity)
1516
- [Labels and Selectors](#labels-and-selectors)
17+
- [Node Selector](#node-selector)
1618
- [Taints](#taints)
1719

1820
## Setup
@@ -537,6 +539,45 @@ spec:
537539
Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pending" state.
538540
</b></details>
539541

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+
540581
## Labels and Selectors
541582

542583
<details>
@@ -557,6 +598,38 @@ Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pendin
557598
`k get deploy -l env=prod,type=web`
558599
</b></details>
559600

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+
560633
## Taints
561634
562635
<details>
@@ -566,7 +639,36 @@ Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pendin
566639
</b></details>
567640
568641
<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>
570643
571644
`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>
672+
673+
`k taint node minikube app=web:NoSchedule-`
572674
</b></details>

topics/kubernetes/README.md

+84-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ What's your goal?
4848
- [Istio](#istio)
4949
- [Controllers](#controllers)
5050
- [Scheduler](#scheduler-1)
51+
- [Node Affinity](#node-affinity)
5152
- [Taints](#taints)
5253
- [Scenarios](#scenarios)
5354

@@ -79,6 +80,8 @@ What's your goal?
7980
|Name|Topic|Objective & Instructions|Solution|Comments|
8081
|--------|--------|------|----|----|
8182
| Labels and Selectors 101 | Labels, Selectors | [Exercise](exercises/labels_and_selectors/exercise.md) | [Solution](exercises/labels_and_selectors/solution.md)
83+
| Node Selectors | Labels, Selectors | [Exercise](exercises/node_selectors/exercise.md) | [Solution](exercises/node_selectors/solution.md)
84+
8285

8386
### Scheduler
8487

@@ -2475,6 +2478,57 @@ spec:
24752478
Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pending" state.
24762479
</b></details>
24772480
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+
24782532
## Taints
24792533
24802534
<details>
@@ -2484,9 +2538,38 @@ Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pendin
24842538
</b></details>
24852539

24862540
<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>
24882542

24892543
`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>
2571+
2572+
`k taint node minikube app=web:NoSchedule-`
24902573
</b></details>
24912574
24922575
<details>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Node Selectors
2+
3+
## Objectives
4+
5+
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Node Selectors
2+
3+
## Objectives
4+
5+
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`.

topics/kubernetes/exercises/taints_101/exercise.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@
66
2. Create a taint on one of the nodes in your cluster with key of "app" and value of "web" and effect of "NoSchedule"
77
1. Explain what it does exactly
88
2. Verify it was applied
9+
3. Run a Pod that will be able to run on the node on which you applied the taint
910

1011
## Solution
1112

12-
Click [here](solution.md) to view the solution.
13-
14-
1. `kubectl describe no minikube | grep -i taints`
15-
2. `kubectl taint node minikube app=web:NoSchedule`
16-
1. Any resource with "app=web" key value will not be scheduled on node `minikube`
17-
2. `kubectl describe no minikube | grep -i taints`
13+
Click [here](solution.md) to view the solution.

0 commit comments

Comments
 (0)