-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59d1d66
commit 816792c
Showing
6 changed files
with
356 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
docs/03-Scheduling/05-Practice-Test-Labels-and-Selectors.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Practice Test - Labels and Selectors | ||
- Take me to [Practice Test](https://kodekloud.com/topic/practice-test-labels-and-selectors/) | ||
|
||
Solutions to Practice Test - Labels and Selectors | ||
1. <details> | ||
<summary>We have deployed a number of PODs. They are labelled with tier, env and bu. How many PODs exist in the dev environment (env)?</summary> | ||
|
||
Here we are filtering pods by the value olf a label | ||
|
||
``` | ||
kubectl get pods --selector env=dev | ||
``` | ||
Count the pods (if any) | ||
</details> | ||
1. <details> | ||
<summary>How many PODs are in the finance business unit (bu)?</summary> | ||
Similarly ... | ||
``` | ||
kubectl get pods --selector bu=finance | ||
``` | ||
Count the pods (if any) | ||
</details> | ||
1. <details> | ||
<summary>How many objects are in the prod environment including PODs, ReplicaSets and any other objects?</summary> | ||
``` | ||
kubectl get all --selector env=prod | ||
``` | ||
Count everything (if anything) | ||
</details> | ||
1. <details> | ||
<summary>Identify the POD which is part of the prod environment, the finance BU and of frontend tier?</summary> | ||
We can combine label expressions with comma. Only items with _all_ the given label/value pairs will be returned, i.e. it is an `and` condition. | ||
``` | ||
kubectl get all --selector env=prod,bu=finance,tier=frontend | ||
``` | ||
</details> | ||
1. <details> | ||
<summary>A ReplicaSet definition file is given replicaset-definition-1.yaml. Try to create the replicaset. There is an issue with the file. Try to fix it.</summary> | ||
``` | ||
kubectl create -f replicaset-definition-1.yaml | ||
``` | ||
Note the error message. | ||
Selector matchLabels should match with POD labels - Update `replicaset-definition-2.yaml` | ||
The values for labels on lines 9 and 13 should match. | ||
``` | ||
$ kubectl create -f replicaset-definition-2.yaml | ||
``` | ||
</details> | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.