diff --git a/README.md b/README.md index 8f7935a..75b5518 100644 --- a/README.md +++ b/README.md @@ -77,8 +77,10 @@ perl
Perl
- Kafka
Kafka
+ Circle CI
Circle CI
Argo
Argo
+ Kafka
Kafka
+ diff --git a/images/logos/circleci.png b/images/logos/circleci.png new file mode 100644 index 0000000..1ddee34 Binary files /dev/null and b/images/logos/circleci.png differ diff --git a/topics/circleci/README.md b/topics/circleci/README.md new file mode 100644 index 0000000..20f9080 --- /dev/null +++ b/topics/circleci/README.md @@ -0,0 +1,44 @@ +# Circle CI + +## Circle CI Questions + +### Circle CI 101 + +
+What is Circle CI?
+ +[Circle CI](https://circleci.com): "CircleCI is a continuous integration and continuous delivery platform that can be used to implement DevOps practices." +
+ +
+What are some benefits of Circle CI?
+ +[Circle CI Docs](https://circleci.com/docs/about-circleci): "SSH into any job to debug your build issues. +Set up parallelism in your .circleci/config.yml file to run jobs faster. +Configure caching with two simple keys to reuse data from previous jobs in your workflow. +Configure self-hosted runners for unique platform support. +Access Arm resources for the machine executor. +Use orbs, reusable packages of configuration, to integrate with third parties. +Use pre-built Docker images in a variety of languages. +Use the API + to retrieve information about jobs and workflows. +Use the CLI to access advanced tools locally. +Get flaky test detection with test insights." +
+ + +
+What is an Orb?
+ +[Circle CI Docs](https://circleci.com/developer/orbs): "Orbs are shareable packages of CircleCI configuration you can use to simplify your builds" + +They can come from the public registry or defined privately as part of an organization. +
+ +### Circle CI Hands-On 101 + +
+Where (in what location in the project) Circle CI pipelines are defined?
+ +`.circleci/config.yml` +
\ No newline at end of file diff --git a/topics/kubernetes/CKA.md b/topics/kubernetes/CKA.md index ca24bd7..145d718 100644 --- a/topics/kubernetes/CKA.md +++ b/topics/kubernetes/CKA.md @@ -12,7 +12,9 @@ - [Deployments](#deployments) - [Troubleshooting Deployments](#troubleshooting-deployments) - [Scheduler](#scheduler) + - [Node Affinity](#node-affinity) - [Labels and Selectors](#labels-and-selectors) + - [Node Selector](#node-selector) - [Taints](#taints) ## Setup @@ -537,6 +539,45 @@ spec: Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pending" state. +### Node Affinity + +
+Using node affinity, set a Pod to schedule on a node where the key is "region" and value is either "asia" or "emea"
+ +`vi pod.yaml` + +```yaml +affinity: + nodeAffinity: + requiredDuringSchedlingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: region + operator: In + values: + - asia + - emea +``` +
+ +
+Using node affinity, set a Pod to never schedule on a node where the key is "region" and value is "neverland"
+ +`vi pod.yaml` + +```yaml +affinity: + nodeAffinity: + requiredDuringSchedlingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: region + operator: NotIn + values: + - neverland +``` +
+ ## Labels and Selectors
@@ -557,6 +598,38 @@ Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pendin `k get deploy -l env=prod,type=web`
+### Node Selector + +
+Apply the label "hw=max" on one of the nodes in your cluster
+ +`kubectl label nodes some-node hw=max` + +
+ +
+reate and run a Pod called `some-pod` with the image `redis` and configure it to use the selector `hw=max`
+ +``` +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 +``` + +
+ +
+Explain why node selectors might be limited
+ +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`. +
+ ## Taints
@@ -566,7 +639,36 @@ Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pendin
-Create a taint on one of the nodes in your cluster with key of "app" and value of "web" and effect of "NoSchedule"
+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
`k taint node minikube app=web:NoSchedule` + +`k describe no minikube | grep -i taints` +
+ +
+You applied a taint with k taint node minikube app=web:NoSchedule on the only node in your cluster and then executed kubectl run some-pod --image=redis. What will happen?
+ +The Pod will remain in "Pending" status due to the only node in the cluster having a taint of "app=web". +
+ +
+You applied a taint with k taint node minikube app=web:NoSchedule on the only node in your cluster and then executed kubectl run some-pod --image=redis but the Pod is in pending state. How to fix it?
+ +`kubectl edit po some-pod` and add the following + +``` + - effect: NoSchedule + key: app + operator: Equal + value: web +``` + +Exit and save. The pod should be in Running state now. +
+ +
+Remove an existing taint from one of the nodes in your cluster
+ +`k taint node minikube app=web:NoSchedule-`
\ No newline at end of file diff --git a/topics/kubernetes/README.md b/topics/kubernetes/README.md index 963fae4..4a914e9 100644 --- a/topics/kubernetes/README.md +++ b/topics/kubernetes/README.md @@ -48,6 +48,7 @@ What's your goal? - [Istio](#istio) - [Controllers](#controllers) - [Scheduler](#scheduler-1) + - [Node Affinity](#node-affinity) - [Taints](#taints) - [Scenarios](#scenarios) @@ -79,6 +80,8 @@ What's your goal? |Name|Topic|Objective & Instructions|Solution|Comments| |--------|--------|------|----|----| | Labels and Selectors 101 | Labels, Selectors | [Exercise](exercises/labels_and_selectors/exercise.md) | [Solution](exercises/labels_and_selectors/solution.md) +| Node Selectors | Labels, Selectors | [Exercise](exercises/node_selectors/exercise.md) | [Solution](exercises/node_selectors/solution.md) + ### Scheduler @@ -2475,6 +2478,57 @@ spec: Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pending" state.
+#### Node Affinity + +
+Using node affinity, set a Pod to schedule on a node where the key is "region" and value is either "asia" or "emea"
+ +`vi pod.yaml` + +```yaml +affinity: + nodeAffinity: + requiredDuringSchedlingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: region + operator: In + values: + - asia + - emea +``` +
+ +
+Using node affinity, set a Pod to never schedule on a node where the key is "region" and value is "neverland"
+ +`vi pod.yaml` + +```yaml +affinity: + nodeAffinity: + requiredDuringSchedlingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: region + operator: NotIn + values: + - neverland +``` +
+ +
+True of False? Using the node affinity type "requiredDuringSchedlingIgnoredDuringExecution" means the scheduler can't schedule unless the rule is met
+ +True +
+ +
+True of False? Using the node affinity type "preferredDuringSchedlingIgnoredDuringExecution" means the scheduler can't schedule unless the rule is met
+ +False. The scheduler tries to find a node that meets the requirements/rules and if it doesn't it will schedule the Pod anyway. +
+ ## Taints
@@ -2484,9 +2538,38 @@ Note: if you don't have a node1 in your cluster the Pod will be stuck on "Pendin
-Create a taint on one of the nodes in your cluster with key of "app" and value of "web" and effect of "NoSchedule"
+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
`k taint node minikube app=web:NoSchedule` + +`k describe no minikube | grep -i taints` +
+ +
+You applied a taint with k taint node minikube app=web:NoSchedule on the only node in your cluster and then executed kubectl run some-pod --image=redis. What will happen?
+ +The Pod will remain in "Pending" status due to the only node in the cluster having a taint of "app=web". +
+ +
+You applied a taint with k taint node minikube app=web:NoSchedule on the only node in your cluster and then executed kubectl run some-pod --image=redis but the Pod is in pending state. How to fix it?
+ +`kubectl edit po some-pod` and add the following + +``` + - effect: NoSchedule + key: app + operator: Equal + value: web +``` + +Exit and save. The pod should be in Running state now. +
+ +
+Remove an existing taint from one of the nodes in your cluster
+ +`k taint node minikube app=web:NoSchedule-`
diff --git a/topics/kubernetes/exercises/node_selectors/exercise.md b/topics/kubernetes/exercises/node_selectors/exercise.md new file mode 100644 index 0000000..1d588b5 --- /dev/null +++ b/topics/kubernetes/exercises/node_selectors/exercise.md @@ -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 \ No newline at end of file diff --git a/topics/kubernetes/exercises/node_selectors/solution.md b/topics/kubernetes/exercises/node_selectors/solution.md new file mode 100644 index 0000000..5b303d4 --- /dev/null +++ b/topics/kubernetes/exercises/node_selectors/solution.md @@ -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`. \ No newline at end of file diff --git a/topics/kubernetes/exercises/taints_101/exercise.md b/topics/kubernetes/exercises/taints_101/exercise.md index 2830398..a5c2e52 100644 --- a/topics/kubernetes/exercises/taints_101/exercise.md +++ b/topics/kubernetes/exercises/taints_101/exercise.md @@ -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` \ No newline at end of file +Click [here](solution.md) to view the solution. \ No newline at end of file diff --git a/topics/kubernetes/exercises/taints_101/solution.md b/topics/kubernetes/exercises/taints_101/solution.md new file mode 100644 index 0000000..26d9ca0 --- /dev/null +++ b/topics/kubernetes/exercises/taints_101/solution.md @@ -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. \ No newline at end of file