devops-exercises/exercises/openshift/README.md
2021-11-26 12:55:02 +02:00

7.9 KiB

OpenShift

OpenShift Exercises

Name Topic Objective & Instructions Solution Comments
My First Project Projects Exercise Solution

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 <role> <user> -n <project>

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: "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