diff --git a/README.md b/README.md index 06b1490..cd12bfe 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Certificates
Certificates
Containers
Containers
sql
SQL
- OpenShift
OpenShift
+ OpenShift
OpenShift
Storage
Storage
HR
HR
@@ -5100,273 +5100,6 @@ as key-value pair, document-oriented, etc. * programming languages -## OpenShift - -### OpenShift Exercises - -|Name|Topic|Objective & Instructions|Solution|Comments| -|--------|--------|------|----|----| -| My First Project | Projects | [Exercise](exercises/openshift/projects_101.md) | [Solution](exercises/openshift/solutions/projects_101.md) - -### OpenShift Self Assessment - -
-What is OpenShift?
- -OpenShift is a container orchestration platform based on Kubernetes.
-It can be used for deploying applications while having minimal management overhead. -
- -
-How OpenShift is related to Kubernetes?
- -It's built on top of Kubernetes while defining its own custom resources in addition to the built ones. -
- -
-True or False? OpenShift is a IaaS (infrastructure as a service) solution
- -False. OpenShift is a PaaS (platform as a service) solution. -
- -## OpenShift - Architecture - -
-What types of nodes OpenShift has?
- -- Workers: Where the end-user applications are running -- Masters: Responsible for managing the cluster -
- -
-Which component responsible for determining pod placement?
- -The Scheduler. -
- -
-What else the scheduler responsible for except pod placement?
- -Application high availability by spreading pod replicas between worker nodes -
- -## OpenShift - Projects - -
-What is a project in OpenShift?
- -A project in OpenShift is a Kubernetes namespace with annotations.
-In simpler words, think about it as an isolated environment for users to manage and organize their resources (like Pods, Deployments, Service, etc.). -
- -
-How to list all projects? What the "STATUS" column means in projects list output?
- -`oc get projects` will list all projects. The "STATUS" column can be used to see which projects are currently active. -
- -
-You have a new team member and you would like to assign to him the "admin" role on your project in OpenShift. How to achieve that?
- -`oc adm policy add-role-to-user -n ` -
- -## OpenShift - Images - -
-What is an image stream?
-
- -
-What would be the best way to run and manage multiple OpenShift environments?
- -Federation -
- -#### OpenShift - Federation - -
-What is OpenShift Federation?
- -Management and deployment of services and workloads accross multiple independent clusters from a single API -
- -
-Explain the following in regards to Federation: - - * Multi Cluster - * Federated Cluster - * Host Cluster - * Member Cluster -
- - * Multi Cluster - Multiple clusters deployed independently, not being aware of each other - * Federated Cluster - Multiple clusters managed by the OpenShift Federation Control Plane - * Host Cluster - The cluster that runs the Federation Control Plane - * Member Cluster - Cluster that is part of the Federated Cluster and connected to Federation Control Plane -
- -## OpenShift - Storage - -
-What is a storage device? What storage devices are there?
- -* Hard Disks -* SSD -* USB -* Magnetic Tape -
- -
-What is Random Seek Time?
- -The time it takes for a disk to reach the place where the data is located and read a single block/sector. - -Bones question: What is the random seek time in SSD and Magnetic Disk? -Answer: Magnetic is about 10ms and SSD is somewhere between 0.08 and 0.16ms -
- -#### OpenShift - Pods - -
-What happens when a pod fails or exit due to container crash
- -Master node automatically restarts the pod unless it fails too often. -
- -
-What happens when a pod fails too often?
- -It's marked as bad by the master node and temporarly not restarted anymore. -
- -
-How to find out on which node a certain pod is running?
- -`oc get po -o wide` -
- -#### OpenShift - Services - -
-Explain Services and their benefits
- - - Services in OpenShift define access policy to one or more set of pods.
- - They are connecting applications together by enabling communication between them - - They provide permanent internal IP addresses and hostnames for applications - - They are able to provide basic internal load balancing -
- -#### OpenShift - Labels - -
-Explain labels. What are they? When do you use them?
- - - Labels are used to group or select API objects - - They are simple key-value pairs and can be included in metadata of some objects - - A common use case: group pods, services, deployments, ... all related to a certain application -
- -#### OpenShift - Service Accounts - -
-How to list Service Accounts?
- -`oc get serviceaccounts` -
- -#### OpenShift - Networking - -
-What is a Route?
- -A route is exposing a service by giving it hostname which is externally reachable -
- -
-What Route is consists of?
- - - name - - service selector - - (optional) security configuration -
- -
-True or False? Router container can run only on the Master node
- -False. It can run on any node. -
- -
-Given an example of how a router is used
- -1. Client is using an address of application running on OpenShift -2. DNS resolves to host running the router -3. Router checks whether route exists -4. Router proxies the request to the internal pod -
- -#### OpenShift - Security - -
-What are "Security Context Constraints"?
- -From [OpenShift Docs](https://docs.openshift.com/container-platform/4.7/authentication/managing-security-context-constraints.html): "Similar to the way that RBAC resources control user access, administrators can use security context constraints (SCCs) to control permissions for pods". -
- -
-How to add the ability for the user `user1` to view the project `wonderland` assuming you are authorized to do so
- -oc adm policy add-role-to-user view user1 -n wonderland -
- -
-How to check what is the current context?
- -`oc whoami --show-context` -
- -#### OpenShift - Serverless - -
-What is OpenShift Serverless?
- - - In general 'serverless' is a cloud computing model where scaling and provisioning is taken care for application developers, so they can focus on the development aspect rather infrastructure related tasks - - OpenShift Serverless allows you to dynamically scale your applications and provides the ability to build event-driven applications, whether the sources are on Kubernetes, the cloud or on-premise solutions - - OpenShift Serverless is based on the Knative project. -
- -
-What are some of the event sources you can use with OpenShift Serverless?
- - * Kafka - * Kubernetes APIs - * AWS Kinesis - * AWS SQS - * JIRA - * Slack - -More are supported and provided with OpenShift. -
- -
-Explain serverless functions
-
- -
-What is the difference between Serverless Containers and Serverless functions?
-
- -#### OpenShift - Misc - -
-What is Replication Controller?
- -Replication Controller responsible for ensuring the specified number of pods is running at all times.
-If more pods are running than needed -> it deletes some of them
-If not enough pods are running -> it creates more -
- ## SQL ### SQL Exercises diff --git a/exercises/aws/README.md b/exercises/aws/README.md index c133084..30101ed 100644 --- a/exercises/aws/README.md +++ b/exercises/aws/README.md @@ -44,6 +44,7 @@ Note: Provided solutions are using the AWS console. It's recommended you'll use |Name|Topic|Objective & Instructions|Solution|Comments| |--------|--------|------|----|----| | Auto Scaling Groups Basics | ASG | [Exercise](auto_scaling_groups_basics.md) | [Solution](solutions/auto_scaling_groups_basics.md) | Easy | +| Dynamic Scaling Policy | ASG, Policies | [Exercise](asg_dynamic_scaling_policy.md) | [Solution](solutions/asg_dynamic_scaling_policy.md) | Easy | #### AWS - Lambda @@ -1287,13 +1288,54 @@ One way is to use CloudWatch alarms where an alarm will monitor a metric and bas
-Provide examples to metrics/rules used for auto scaling
+What are some metrics/rules used for auto scaling
* Network In/Out * Number of requests on ELB per instance * Average CPU, RAM usage
+
+What is dynamic Scaling policy in regards to Auto Scaling Groups?
+ +A policy in which scaling will occur automatically based on different metrics. + +There are 3 types: + +1. Target Tracking Scaling: scale when the baseline changes (e.g. CPU is over 60%) +2. Step Scaling: more granular scaling where you can choose different actions for different metrics values (e.g. when CPU less than 20%, remove one instance. When CPU is over 40%, add 3 instances) +3. Scheduled Actions: set in advance scaling for specific period of time (e.g. add instances on Monday between 10:00 am to 11:00 am) +
+ +
+What is a predictive scaling policy in regards to Auto Scaling Groups?
+ +Scale by analyzing historical load and schedule scaling based on forecast load. +
+ +
+Explain scaling cooldowns in regards to Auto Scaling Groups
+ +During a scaling cooldown, ASG will not terminate or launch additional instances. The cooldown happens after scaling activity and the reason for this behaviour is that some metrics have to be collected and stabilize before another scaling operating can take place. +
+ +
+Explain the default ASG termination policy
+ +1. It finds the AZ which the most number of EC2 instnaces +2. If number of instances > 1, choose the with oldest launch configuration, template and terminate it +
+ +
+True or False? by deafult, ASG tries to balance the number of instances across AZ
+ +True, this is why when it terminates instances, it chooses the AZ with the most instances. +
+ +
+Explain Lifecycle Hooks in regards to Auto Scaling Groups
+
+ #### AWS - Security
diff --git a/exercises/aws/asg_dynamic_scaling_policy.md b/exercises/aws/asg_dynamic_scaling_policy.md new file mode 100644 index 0000000..2611fdb --- /dev/null +++ b/exercises/aws/asg_dynamic_scaling_policy.md @@ -0,0 +1,16 @@ +## AWS Auto Scaling Groups - Dynamic Scaling Policy + +### Requirements + +1. Existing Auto Scaling Group with maximum capacity set to at least 3 +2. One running EC2 instance with max of 4 CPUs + +### Objectives + +1. Create a dynamic scaling policy with the following properties + 1. Track average CPU utilization + 2. Target value should be 70% +2. Increase the CPU utilization to at least 70% + 1. Do you see change in number of instances? +1. Decrease CPU utilization to less than 70% + 1. Do you see change in number of instances? diff --git a/exercises/aws/solutions/asg_dynamic_scaling_policy.md b/exercises/aws/solutions/asg_dynamic_scaling_policy.md new file mode 100644 index 0000000..7a7c1f5 --- /dev/null +++ b/exercises/aws/solutions/asg_dynamic_scaling_policy.md @@ -0,0 +1,37 @@ +## AWS Auto Scaling Groups - Dynamic Scaling Policy + +### Requirements + +1. Existing Auto Scaling Group with maximum capacity set to at least 3 +2. One running EC2 instance with max of 4 CPUs + +### Objectives + +1. Create a dynamic scaling policy with the following properties + 1. Track average CPU utilization + 2. Target value should be 70% +2. Increase the CPU utilization to at least 70% + 1. Do you see change in number of instances? +1. Decrease CPU utilization to less than 70% + 1. Do you see change in number of instances? + +### Solution + +#### Console + +1. Go to EC2 service -> Auto Scaling Groups and click on the tab "Automating scaling" +2. Choose "Target tracking scaling" under "Policy Type" +3. Set metric type to Average CPU utilization +4. Set target value to 70% and click on "Create" + +1. If you are using Amazon Linux 2, you can stress the instance with the following: + +``` +sudo amazon-linux-extras install epel -y +sudo yum install stress -y +stress -c 4 # assuming you have 4 CPUs +``` +2. Yes, additional EC2 instance was added + +1. Simply stop the stress command +2. Yes, one of the EC2 instances was terminated diff --git a/exercises/openshift/README.md b/exercises/openshift/README.md new file mode 100644 index 0000000..371c0aa --- /dev/null +++ b/exercises/openshift/README.md @@ -0,0 +1,266 @@ +## OpenShift + +### OpenShift Exercises + +|Name|Topic|Objective & Instructions|Solution|Comments| +|--------|--------|------|----|----| +| My First Project | Projects | [Exercise](projects_101.md) | [Solution](solutions/projects_101.md) + +### OpenShift Self Assessment + +
+What is OpenShift?
+ +OpenShift is a container orchestration platform based on Kubernetes.
+It can be used for deploying applications while having minimal management overhead. +
+ +
+How OpenShift is related to Kubernetes?
+ +It's built on top of Kubernetes while defining its own custom resources in addition to the built ones. +
+ +
+True or False? OpenShift is a IaaS (infrastructure as a service) solution
+ +False. OpenShift is a PaaS (platform as a service) solution. +
+ +## OpenShift - Architecture + +
+What types of nodes OpenShift has?
+ +- Workers: Where the end-user applications are running +- Masters: Responsible for managing the cluster +
+ +
+Which component responsible for determining pod placement?
+ +The Scheduler. +
+ +
+What else the scheduler responsible for except pod placement?
+ +Application high availability by spreading pod replicas between worker nodes +
+ +## OpenShift - Projects + +
+What is a project in OpenShift?
+ +A project in OpenShift is a Kubernetes namespace with annotations.
+In simpler words, think about it as an isolated environment for users to manage and organize their resources (like Pods, Deployments, Service, etc.). +
+ +
+How to list all projects? What the "STATUS" column means in projects list output?
+ +`oc get projects` will list all projects. The "STATUS" column can be used to see which projects are currently active. +
+ +
+You have a new team member and you would like to assign to him the "admin" role on your project in OpenShift. How to achieve that?
+ +`oc adm policy add-role-to-user -n ` +
+ +## OpenShift - Images + +
+What is an image stream?
+
+ +
+What would be the best way to run and manage multiple OpenShift environments?
+ +Federation +
+ +#### OpenShift - Federation + +
+What is OpenShift Federation?
+ +Management and deployment of services and workloads accross multiple independent clusters from a single API +
+ +
+Explain the following in regards to Federation: + + * Multi Cluster + * Federated Cluster + * Host Cluster + * Member Cluster +
+ + * Multi Cluster - Multiple clusters deployed independently, not being aware of each other + * Federated Cluster - Multiple clusters managed by the OpenShift Federation Control Plane + * Host Cluster - The cluster that runs the Federation Control Plane + * Member Cluster - Cluster that is part of the Federated Cluster and connected to Federation Control Plane +
+ +## OpenShift - Storage + +
+What is a storage device? What storage devices are there?
+ +* Hard Disks +* SSD +* USB +* Magnetic Tape +
+ +
+What is Random Seek Time?
+ +The time it takes for a disk to reach the place where the data is located and read a single block/sector. + +Bones question: What is the random seek time in SSD and Magnetic Disk? +Answer: Magnetic is about 10ms and SSD is somewhere between 0.08 and 0.16ms +
+ +#### OpenShift - Pods + +
+What happens when a pod fails or exit due to container crash
+ +Master node automatically restarts the pod unless it fails too often. +
+ +
+What happens when a pod fails too often?
+ +It's marked as bad by the master node and temporarly not restarted anymore. +
+ +
+How to find out on which node a certain pod is running?
+ +`oc get po -o wide` +
+ +#### OpenShift - Services + +
+Explain Services and their benefits
+ + - Services in OpenShift define access policy to one or more set of pods.
+ - They are connecting applications together by enabling communication between them + - They provide permanent internal IP addresses and hostnames for applications + - They are able to provide basic internal load balancing +
+ +#### OpenShift - Labels + +
+Explain labels. What are they? When do you use them?
+ + - Labels are used to group or select API objects + - They are simple key-value pairs and can be included in metadata of some objects + - A common use case: group pods, services, deployments, ... all related to a certain application +
+ +#### OpenShift - Service Accounts + +
+How to list Service Accounts?
+ +`oc get serviceaccounts` +
+ +#### OpenShift - Networking + +
+What is a Route?
+ +A route is exposing a service by giving it hostname which is externally reachable +
+ +
+What Route is consists of?
+ + - name + - service selector + - (optional) security configuration +
+ +
+True or False? Router container can run only on the Master node
+ +False. It can run on any node. +
+ +
+Given an example of how a router is used
+ +1. Client is using an address of application running on OpenShift +2. DNS resolves to host running the router +3. Router checks whether route exists +4. Router proxies the request to the internal pod +
+ +#### OpenShift - Security + +
+What are "Security Context Constraints"?
+ +From [OpenShift Docs](https://docs.openshift.com/container-platform/4.7/authentication/managing-security-context-constraints.html): "Similar to the way that RBAC resources control user access, administrators can use security context constraints (SCCs) to control permissions for pods". +
+ +
+How to add the ability for the user `user1` to view the project `wonderland` assuming you are authorized to do so
+ +oc adm policy add-role-to-user view user1 -n wonderland +
+ +
+How to check what is the current context?
+ +`oc whoami --show-context` +
+ +#### OpenShift - Serverless + +
+What is OpenShift Serverless?
+ + - In general 'serverless' is a cloud computing model where scaling and provisioning is taken care for application developers, so they can focus on the development aspect rather infrastructure related tasks + - OpenShift Serverless allows you to dynamically scale your applications and provides the ability to build event-driven applications, whether the sources are on Kubernetes, the cloud or on-premise solutions + - OpenShift Serverless is based on the Knative project. +
+ +
+What are some of the event sources you can use with OpenShift Serverless?
+ + * Kafka + * Kubernetes APIs + * AWS Kinesis + * AWS SQS + * JIRA + * Slack + +More are supported and provided with OpenShift. +
+ +
+Explain serverless functions
+
+ +
+What is the difference between Serverless Containers and Serverless functions?
+
+ +#### OpenShift - Misc + +
+What is Replication Controller?
+ +Replication Controller responsible for ensuring the specified number of pods is running at all times.
+If more pods are running than needed -> it deletes some of them
+If not enough pods are running -> it creates more +
diff --git a/exercises/openshift/projects_101.md b/exercises/openshift/projects_101.md index 3ccbf9f..ac3acec 100644 --- a/exercises/openshift/projects_101.md +++ b/exercises/openshift/projects_101.md @@ -1,5 +1,7 @@ ## OpenShift - Projects 101 +### Objectives + In a newly deployed cluster (preferably) perform and answer the following instructions and questions, using CLI only 1. Login to the OpenShift cluster diff --git a/exercises/openshift/solutions/projects_101.md b/exercises/openshift/solutions/projects_101.md index e7e2265..c9c6f49 100644 --- a/exercises/openshift/solutions/projects_101.md +++ b/exercises/openshift/solutions/projects_101.md @@ -1,4 +1,6 @@ -## Projects 101 - Solution +## OpenShift - Projects 101 + +### Objectives 1. Login to the OpenShift cluster -> `oc login -u YOUR_USER -p YOUR_PASSWORD_OR_TOKEN` 2. List all the projects -> `oc get projects`(The output should be empty in a newly created cluster)