Skip to content

Commit 422a48a

Browse files
author
abregman
committed
Add k8s questions
Updated CKA page as well.
1 parent ad66a50 commit 422a48a

File tree

5 files changed

+551
-76
lines changed

5 files changed

+551
-76
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
:information_source:  This repo contains questions and exercises on various technical topics, sometimes related to DevOps and SRE
44

5-
:bar_chart:  There are currently **2354** exercises and questions
5+
:bar_chart:  There are currently **2406** exercises and questions
66

77
:books:  To learn more about DevOps and SRE, check the resources in [devops-resources](https://github.com/bregman-arie/devops-resources) repository
88

topics/circleci/README.md

+41
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ Use the CLI to access advanced tools locally.
2626
Get flaky test detection with test insights."
2727
</b></details>
2828

29+
<details>
30+
<summary>Explain the following:
31+
32+
* Pipeline
33+
* Workflow
34+
* Jobs
35+
* Steps
36+
</summary><br><b>
37+
38+
* Pipeline: the entire CI/CD configuration (.circleci/config.yaml)
39+
* Workflow: primarily used when there is more than one job in the configuration to orchestrate the workflows
40+
* Jobs: One or more steps to execute as part of the CI/CD process
41+
* Steps: The actual commands to execute
42+
</b></details>
2943

3044
<details>
3145
<summary>What is an Orb?</summary><br><b>
@@ -41,4 +55,31 @@ They can come from the public registry or defined privately as part of an organi
4155
<summary>Where (in what location in the project) Circle CI pipelines are defined?</summary><br><b>
4256

4357
`.circleci/config.yml`
58+
</b></details>
59+
60+
<details>
61+
<summary>Explain the following configuration file
62+
63+
64+
```
65+
version: 2.1
66+
67+
jobs:
68+
say-hello:
69+
docker:
70+
- image: cimg/base:stable
71+
steps:
72+
- checkout
73+
- run:
74+
name: "Say hello"
75+
command: "echo Hello, World!"
76+
workflows:
77+
say-hello-workflow:
78+
jobs:
79+
- say-hello
80+
```
81+
</summary><br><b>
82+
83+
This configuration file will set up one job that will checkout the code of the project will run the command `echo Hello, World!`.
84+
It will run in a container using the image `cimg/base:stable`.
4485
</b></details>

topics/kubernetes/CKA.md

+98
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- [Labels and Selectors](#labels-and-selectors)
1717
- [Node Selector](#node-selector)
1818
- [Taints](#taints)
19+
- [Resources Limits](#resources-limits)
1920

2021
## Setup
2122

@@ -255,6 +256,12 @@ Note: create an alias (`alias k=kubectl`) and get used to `k get no`
255256
`k get nodes -o json > some_nodes.json`
256257
</b></details>
257258

259+
<details>
260+
<summary>Check what labels one of your nodes in the cluster has</summary><br><b>
261+
262+
`k get no minikube --show-labels`
263+
</b></details>
264+
258265
## Services
259266

260267
<details>
@@ -450,6 +457,42 @@ The selector doesn't match the label (cache vs cachy). To solve it, fix cachy so
450457

451458
</b></details>
452459

460+
<details>
461+
<summary>Create a deployment called "pluck" using the image "redis" and make sure it runs 5 replicas</summary><br><b>
462+
463+
`kubectl create deployment pluck --image=redis`
464+
465+
`kubectl scale deployment pluck --replicas=5`
466+
467+
</b></details>
468+
469+
<details>
470+
<summary>Create a deployment with the following properties:
471+
472+
* called "blufer"
473+
* using the image "python"
474+
* runs 3 replicas
475+
* all pods will be placed on a node that has the label "blufer"
476+
</summary><br><b>
477+
478+
`kubectl create deployment blufer --image=python --replicas=3 -o yaml --dry-run=client > deployment.yaml`
479+
480+
Add the following section (`vi deployment.yaml`):
481+
482+
```
483+
spec:
484+
affinity:
485+
nodeAffinity:
486+
requiredDuringSchedlingIgnoredDuringExecution:
487+
nodeSelectorTerms:
488+
- matchExpressions:
489+
- key: blufer
490+
operator: Exists
491+
```
492+
493+
`kubectl apply -f deployment.yaml`
494+
</b></details>
495+
453496
### Troubleshooting Deployments
454497

455498
<details>
@@ -671,4 +714,59 @@ Exit and save. The pod should be in Running state now.
671714
<summary>Remove an existing taint from one of the nodes in your cluster</summary><br><b>
672715
673716
`k taint node minikube app=web:NoSchedule-`
717+
</b></details>
718+
719+
## Resources Limits
720+
721+
<details>
722+
<summary>Check if there are any limits on one of the pods in your cluster</summary><br><b>
723+
724+
`kubectl describe po <POD_NAME> | grep -i limits`
725+
</b></details>
726+
727+
<details>
728+
<summary>Run a pod called "yay" with the image "python" and resources request of 64Mi memory and 250m CPU</summary><br><b>
729+
730+
`kubectl run yay --image=python --dry-run=client -o yaml > pod.yaml`
731+
732+
`vi pod.yaml`
733+
734+
```
735+
spec:
736+
containers:
737+
- image: python
738+
imagePullPolicy: Always
739+
name: yay
740+
resources:
741+
requests:
742+
cpu: 250m
743+
memory: 64Mi
744+
```
745+
746+
`kubectl apply -f pod.yaml`
747+
</b></details>
748+
749+
<details>
750+
<summary>Run a pod called "yay2" with the image "python". Make sure it has resources request of 64Mi memory and 250m CPU and the limits are 128Mi memory and 500m CPU</summary><br><b>
751+
752+
`kubectl run yay2 --image=python --dry-run=client -o yaml > pod.yaml`
753+
754+
`vi pod.yaml`
755+
756+
```
757+
spec:
758+
containers:
759+
- image: python
760+
imagePullPolicy: Always
761+
name: yay2
762+
resources:
763+
limits:
764+
cpu: 500m
765+
memory: 128Mi
766+
requests:
767+
cpu: 250m
768+
memory: 64Mi
769+
```
770+
771+
`kubectl apply -f pod.yaml`
674772
</b></details>

0 commit comments

Comments
 (0)