On Premise vs. Cloud: Cloud Computing Has Grown Very Popular For Enterprises, Everything From
On Premise vs. Cloud: Cloud Computing Has Grown Very Popular For Enterprises, Everything From
Cloud
Cloud computing has grown very popular for enterprises, everything from
saving time and money to improving agility and scalability. On the other hand, on-
premise software – installed on a company’s own servers and behind its firewall –
was the only offering for organizations for a long time and may continue to adequately
serve your business needs. Additionally, on-premise applications are reliable, secure,
and allow enterprises to maintain a level of control that the cloud often cannot.
1. Deployment
2. Cost
3. Control
4. Security
5. Compliance
IAAS, PAAS, SAAS:
Basics
Container: A container is a standard unit of software that packages up code and all its
dependencies so the application runs quickly and reliably from one computing
environment to another.
Containers take up less space than VMs (container images are typically tens of
MBs in size), can handle more applications and require fewer VMs and Operating
systems. Virtual machines (VMs) are an abstraction of physical hardware turning one
server into many servers. The hypervisor allows multiple VMs to run on a single
machine. Each VM includes a full copy of an operating system, the application,
necessary binaries and libraries - taking up tens of GBs. VMs can also be slow to boot.
Images can exist without containers, whereas a container needs to run an image
to exist. Therefore, containers are dependent on images and use them to construct a
run-time environment and run an application.
Orchestration: IT teams must manage many servers and applications, but doing so
manually isn’t a scalable strategy. The need to combine multiple automated tasks and
their configurations across groups of systems or machines increases. That’s where
orchestration can help.
https://www.youtube.com/watch?v=KTN_QBuDplo&t=59s
Architecture
1. Infrastructure layer: Also knows as base layer, where you can host your applications on
physical servers, virtual servers, or even on the cloud (private/public).
2. Service layer: The service layer is responsible for defining pods and access policy. The
service layer provides a permanent IP address and host name to the pods; connects
applications together; and allows simple internal load balancing, distributing tasks across
application components.
3. Master
The Main node is responsible for managing the cluster, and it takes care of the worker
nodes. It has four components:
(a) Etcd/ Data Store: It stores the configuration information, which can be used by each
of the nodes in the cluster.
(b) API Server: The Kubernetes API server validates and configures the data for
pods, services, and replication controllers. Any administration request goes through the
API; these requests are SSL-encrypted and authenticated to ensure the security of the
cluster. It also assigns pods to nodes and synchronizes pod information with service
configuration.
(c) Controller Manager Server: This component is responsible for most of the collectors
that regulate the state of the cluster and perform a task. It can be considered as a
daemon which runs in a non-terminating loop. The key controllers are replication
controller, endpoint controller, namespace controller, and service account controller.
The controller manager runs different kind of controllers to handle nodes, endpoint, etc.
PVCs are specific to a project, and are created and used by developers as a means to
use a PV. PV resources on their own are not scoped to any single project; they can be
shared across the entire OpenShift Container Platform cluster and claimed from
any project. After a PV is bound to a PVC, that PV cannot then be bound to additional
PVCs. This has the effect of scoping a bound PV to a single namespace, that of the
binding project.
7. Routing layer: This represents all the routes created for different applications where
incoming traffic will pass through routing layer.
https://www.youtube.com/watch?v=0swOh5C3OVM
8. Kubernetes Node: Following are the key components of the Node server, which are
necessary to communicate with the Kubernetes master.
(a) Docker: The first requirement of each node is Docker which helps in running the
encapsulated application containers in a relatively isolated but lightweight operating
environment.
(b) Kubelet Service: This is a small service in each node, which is responsible for relaying
information to and from the control plane service. It interacts with etcd store to read the
configuration details and Wright values. This communicates with the master
component to receive commands and work. Each node has a kubelet that updates the
node as specified by a container manifest, which is a YAML file that describes a pod.
(c) Kubernetes Proxy Service: This is a proxy service which runs on each node and helps
in making the services available to the external host. It helps in forwarding the request to
correct containers. Kubernetes Proxy Service is capable of carrying out primitive load
balancing. It makes sure that the networking environment is predictable and accessible
but at the same time it is isolated as well. It manages pods on node, volumes, secrets,
creating new containers health checkup, etc.
9. Infrastructure nodes: are nodes that are labeled to run pieces of the OpenShift
Container Platform environment.
Currently, the easiest way to manage node reboots is to ensure that there are at least three
nodes available to run infrastructure. The scenario below demonstrates a common mistake
that can lead to service interruptions for the applications running on OpenShift Container
Platform when only two nodes are available.
Node A is marked unschedulable and all pods are evacuated. The registry pod running on
that node is now redeployed on node B. This means node B is now running both registry
pods. Node B is now marked unschedulable and is evacuated. The service exposing the
two pod endpoints on node B, for a brief period of time, loses all endpoints until they are
redeployed to node A.
The same process using three infrastructure nodes does not result in a service
disruption. However, due to pod scheduling, the last node that is evacuated and brought
back in to rotation is left running zero registries. The other two nodes will run two and
one registries respectively.
Terminologies:
Image − Kubernetes (Docker) images are the key building blocks of Containerized
Infrastructure. Each container in a pod has its Docker image running inside it. When
configuring a pod, the image property in the configuration file has the same syntax as
the Docker command (YAML or JSON files).
Project − they can be defined as the renamed version of the domain which was present
in the earlier version of OpenShift V2.
Container − they are the ones which are created after the image is deployed on a
Kubernetes cluster node.
Node − A node is a working machine in Kubernetes cluster, which is also known as
minion for master. They are working units which can a physical, VM, or a cloud
instance.
Pod − A pod is a collection of containers and its storage inside a node of a Kubernetes
cluster. It is possible to create a pod with multiple containers inside it. For example,
keeping the database container and web server container inside the pod
Two services should be running all the time
(a) Docker Service (b) Atomic open-shift node service
Pods
Pods are the smallest, most basic deployable objects. A Pod represents a single
instance of a running process in your cluster. Pods contain one or more containers,
such as Docker containers. When a Pod runs multiple containers, the containers are
managed as a single entity and share the Pod's resources. Each pod is allocated its own
internal IP address, therefore owning its entire port space, and containers within pods
can share their local storage and networking. Containers in a Pod communicate with
each other inside the Pod on localhost. Pods can specify a set of shared storage
volumes that can be shared among the containers.
Lifecycle of pods
Pending: Pod has been created and accepted by the cluster, but one or more
of its containers are not yet running. This phase includes time spent being
scheduled on a node and downloading images.
Running: Pod has been bound to a node, and all of the containers have
been created. At least one container is running, is in the process of starting,
or is restarting.
Succeeded: All containers in the Pod have terminated successfully.
Terminated Pods do not restart.
Failed: All containers in the Pod have terminated, and at least one container
has terminated in failure. A container "fails" if it exits with a non-zero
status.
Unknown: The state of the Pod cannot be determined.
Secrets
Every time you log in a user will be created, you can get the list of users from
the command oc get users. Three types of accounts user, system and service accounts.
When you (a human) access the cluster you are authenticated by the apiserver
as a particular User Account. Processes in containers inside pods can also contact the
apiserver. When they do, they are authenticated as a particular Service Account (for
example, default).
When a person uses the OpenShift Container Platform CLI or web console,
their API token authenticates them to the OpenShift API. However, when a regular
user’s credentials are not available, it is common for components to make API calls
independently. For example:
Service accounts provide a flexible way to control API access without sharing a
regular user’s credentials. Every service account has an associated user name that can be
granted roles, just like a regular user. Applications are authorized to perform certain actions
based on the service account selected.
Operator
Stateless Application: A stateless application is one that neither reads nor stores
information about its state from one time that it is run to the next. (Automated by
control loop in Kubernetes). Suppose if one pod dies then Kubernetes automated
control will bring it up using control loop automation.
Stateful Application: A stateful application, on the other hand, can remember at least
some things about its state each time that it runs. (So storage is required). It requires
human interaction here to make decisions.
Operator replaces the human interaction with a software operator (code), all the
manual tasks will be done by program by making the decision by checking the state of
the service or replicas of them. It is a custom control loop. It can be used for creating
clusters, backups, synchronizing, checking health, monitoring logs etc. Example:
Prometheus operator, my-SQL operator etc.
Suppose let’s say we have databases that is scaled up we might have data
inconsistency issue if one pod goes down. In these cases we can configure operators in
openshift to take care of specific issues.
https://youtu.be/JMrxPyv9nxQ
The smallest unit for communication is pod not a container. Every POD has
unique IP address and containers share the network space of pods. When a pod gets
attached to node it gets its own network namespace and virtual Ethernet connection.
Pod is a host just like a PC.
Types of communication:
Intra Pod communication: If pods are in same node then they can directly
communicate without creating a route.
The first two type can be done using IP address and DNS names but the last two
should be done using the services. ClusterIP is the IP assigned to the service. If we
create route then the service is accessible from outside.
ClusterIP: is a default Kubernetes service. This service is created inside a cluster and can
only be accessed by other pods in that cluster. So basically we use this type of service when
we want to expose a service to other pods within the same cluster.
Nodeport: NodePort opens a specific port on your node/VM and when that port gets traffic,
that traffic is forwarded directly to the service. There are a few limitations and hence it’s not
advised to use NodePort. only one service per port and You can only use ports 30000-32767.
Load Balancer: This is the standard way to expose service to the internet. All the traffic on
the port is forwarded to the service. It's designed to assign an external IP to act as a load
balancer for the service. There's no filtering, no routing. LoadBalancer uses cloud service.
OpenShift SDN provides three SDN plug-ins for configuring the pod network:
The ovs-subnet plug-in is the original plug-in, which provides a "flat" pod
network where every pod can communicate with every other pod and service.
The ovs-multitenant plug-in provides project-level isolation for pods and
services. Each project receives a unique Virtual Network ID (VNID) that
identifies traffic from pods assigned to the project. Pods from different projects
cannot send packets to or receive packets from pods and services of a different
project.
The ovs-networkpolicy plug-in (currently in Tech Preview) allows project
administrators to configure their own isolation policies using NetworkPolicy
objects.
OpenShift DNS: Every single pod, container will be assigned a DNS name that can
be used to communicate with the pods.
If you are running multiple services, such as frontend and backend services
for use with multiple pods, in order for the frontend pods to communicate with the
backend services, environment variables are created for user names, service IP,
and more. If the service is deleted and recreated, a new IP address can be assigned to
the service, and requires the frontend pods to be recreated in order to pick up the
updated values for the service IP environment variable. Additionally, the backend
service has to be created before any of the frontend pods to ensure that the service IP
is generated properly and that it can be provided to the frontend pods as an
environment variable.
For this reason, OpenShift has a built-in DNS so that the services can be reached by
the service DNS as well as service IP/port. OpenShift supports split DNS by running
SkyDNS on the master that answers DNS queries for services. The master listens to
port 53 by default.
This prevents having to restart frontend pods in order to pick up new services,
which creates a new IP for the service. This also removes the need to use environment
variables, as pods can use the service DNS.
Liveness & Readiness Probe OpenShift (Application Health)
1. HTTP Checks: The kubelet uses a web hook to determine the healthiness of
the container
2. Container Execution Checks: The kubelet executes a command inside the
container
3. TCP Socket Checks: The kubelet attempts to open a socket to the container.
The container is only considered healthy if the check can establish a
connection.
PV and PVC
PVCs are specific to a project, and are created and used by developers as a
means to use a PV. PV resources on their own are not scoped to any single
project; they can be shared across the entire OpenShift Container Platform
cluster and claimed from any project. After a PV is bound to a PVC, that PV cannot
then be bound to additional PVCs. This has the effect of scoping a bound PV to a
single namespace, that of the binding project.
OpenShift clusters can be provisioned with persistent storage using NFS. Persistent
volumes (PVs) and persistent volume claims (PVCs) provide a convenient method for sharing
a volume across a project. While the NFS-specific information contained in a PV definition
could also be defined directly in a pod definition, doing so does not create the volume as a
distinct cluster resource, making the volume more susceptible to conflicts.
https://www.youtube.com/watch?v=0swOh5C3OVM
What are image pull secrets?
If you are using OpenShift Container Platform’s internal registry and are
pulling from imagestreams located in the same project, then your Pod’s service
account should already have the correct permissions and no additional action should
be required. However, for other scenarios, such as referencing images across
OpenShift Container Platform projects or from secured registries, then additional
configuration steps are required.
When using the internal registry, to allow Pods in project-a to reference images in
project-b, a service account in project-a must be bound to the system:image-puller
role in project-b.
The config.json file for Docker clients is a Docker credentials file that stores your
authentication information if you have previously logged into a secured or insecure
registry. To pull a secured container image that is not from OpenShift Container
Platform’s internal registry, you must create a pull secret from your Docker
credentials and add it to your service account.
Build Strategies
In the build configuration file we give the address/location of the source code.
But if somehow the image gets updated, then there might be issues in the performance
or problems of code. To prevent such issues, we have Image streams. Image streams
maps the actual location of the Images of source code to the image names with
the project. They are like pointers to the actual docker images not docker images
them-selves.
Image streams are created after pulling the images. The advantage of an image
stream is that it looks for updates on the new version of an image. This is used to
compare any number of Docker formatted container images identified by tags. Image
streams can automatically perform an action when a new image is created. All the
builds and deployments can watch for image action and perform an action
accordingly.
OpenShift components such as builds and deployments can watch an image
stream to receive notifications when new images are added and react by performing a
build or a deployment.
Roles are collections of policy rules, which are sets of permitted verbs that can be
performed on a set of resources.
A role binding grants the permissions defined in a role to a user or set of users.
It holds a list of subjects (users, groups, or service accounts), and a reference to the
role being granted. A RoleBinding grants permissions within a specific namespace
whereas a ClusterRoleBinding grants that access cluster-wide.
3 components in RBAC
In addition to authorization policies that control what a user can do, OpenShift
provides security context constraints (SCC) that control the actions that a pod can
perform and what it has the ability to access. Administrators can manage SCCs using
the CLI.
SCCs are objects that define a set of conditions that a pod must run with in order to be
accepted into the system. They allow an administrator to control the following:
The users and groups fields on the SCC control which SCCs can be used. By
default, cluster administrators, nodes, and the build controller are granted access to the
privileged SCC. All authenticated users are granted access to the restricted SCC.
Privileged SCC: allows privileged pods. Allows host directories to be mounted as
volumes. Allows a pod to run as any user. Allows a pod to run with any MCS label.
Restricted SCC: ensures pods cannot run as privileged. Ensures pods cannot use host
directory volumes. Requires that a pod run as a user in a pre-allocated range of UIDs.
Requires that a pod run with a pre-allocated MCS label.
Using quotas and limit ranges, cluster administrators can set constraints to
limit the number of objects or amount of compute resources that are used in your
project. This helps cluster administrators better manage and allocate resources across
all projects, and ensure that no projects are using more than is appropriate for the
cluster size. If not requested specifically the default values will be assigned to project.
If project modifications exceed a quota usage limit, the server denies the action. An
appropriate error message is returned explaining the quota constraint violation and the
currently observed usage stats are in the system.
Deployment Strategies
2. Recreate Strategy: will execute any pre lifecycle hook, Scale down the
previous deployment to zero, Execute any mid lifecycle hook, Scale up the new
deployment, Execute any post lifecycle hook.
A recreate deployment incurs downtime because, for a brief period, no
instances of your application are running. However, your old code and new
code do not run at the same time.
When to use: When you must run migrations or other data transformations
before your new code starts. When you do not support having new and old
versions of your application code running at the same time.
3. Custom Strategy: The Custom strategy allows you to provide your own
deployment behaviour.
When to use: Use a blue-green deployment when you want to test a new
version of your application in a production environment before moving
traffic to it. Blue-green deployments make switching between two different
versions of your application easy.
b) A/B Deployment: A/B deployments generally imply running two (or more)
versions of the application code or application configuration at the same
time for testing or experimentation purposes. The simplest form of an A/B
deployment is to divide production traffic between two or more distinct
shards — a single group of instances with homogeneous configuration and
code.
1. Must-gather: Bulk collect data about the current state of your cluster to debug issues.
$ oc adm must-gather
2. Top: Show usage statistics of resources on the server.
Issue tracking: Issue tracking software is a customer service tool that records
incoming support cases from start to finish. The app monitors the cases’ progress and
provides updates to the user whenever there's a change on the customer's ticket. This
ensures that service cases are completed on-time and that no customer is overlooked
by the support team. Example: Hubspot, Atlassian JIRA, Zoho, Backlog etc.
Code Review: Code review is a part of the software development process which involves
testing the source code to identify bugs at an early stage. A code review process is typically
conducted before merging with the codebase. An effective code review prevents bugs and
errors from getting into your project by improving code quality at an early stage of the
software development process. Example: Github, Review Board, Crucible, CodeScene,
UpSource, Gerrit etc.
Test Management Tools: The term “Test Management” encompasses anything and
everything that testers do and take the help of a best and efficient test management software
to perform this task.
The test management process involves the set of tasks/activities that are mentioned
above. This process is critical, detail-oriented and instrumental in order to make sure that the
entire testing effort is successful. Example: qTest, Zephyr, XQual, TestMonitor, IBM rational
quality Manager etc
Agile management tools: Agile is a project management methodology, mainly used for
software development, which is attributed to the division of a whole task into multiple
smaller tasks and attach them with the short & incremental phases of work known as sprints.
The main intention behind this approach is rapid & early delivery, frequent reassessment &
adaptive planning, continuous improvement and flexible response to change.
Agile testers need to monitor their project constantly for this management tools are
required. Example: monday.com, Jira, Zephyr, Soap UI etc.
DevOps
Error Log
1. Minishift - cannot start - Error starting the VM: Error getting the state for host: machine does
not exist error from CMD)
Solution: minishift delete --clear-cache (command), Restarting minishift will recreate all
necessary stuff.
2. Copy files from local to VirtualBox
https://www.howtogeek.com/189974/how-to-share-your-computers-files-with-
a-virtual-machine/
https://www.howtogeek.com/189974/how-to-share-your-computers-files-with-
a-virtual-machine/
6. Network discovery turn on
https://www.google.com/search?
q=network+discovery+is+turned+off&rlz=1C1CHBF_enIN914IN914&oq=net
work+dis&aqs=chrome.0.0i457j0i20i263j69i57j0j0i20i263j0l3.4863j0j7&sour
ceid=chrome&ie=UTF-8
7. VirtualBox fails with “Implementation of the USB 2.0 controller not found”
after upgrading
https://askubuntu.com/questions/453393/virtualbox-fails-with-implementation-
of-the-usb-2-0-controller-not-found-after
Kinds of PV Used
NFS, AWS Elastic Block Store (EBS),Azure Disk, Azure File, Cinder, Fibre Channel, GCE
Persistent Disk, HostPath, iSCSI, Local volume, NFS, Red Hat OpenShift Container Storage,
VMware vSphere.
EmptyDir
Gets created as soon as the pod gets assigned to the node. The simplest volume type is
EmptyDir, which is a temporary directory on a single machine. Administrators may also
allow you to request a persistent volume that is automatically attached to your pods.
Containers are not persistent by default; on restart, their contents are cleared.
Create a new project you can check the logs to follow the build -> once the build is
complete, two pods should be running: a database and an application -> Visit the
application URL. The Cake PHP framework welcome page should be visible -> once
the functionality has been verified, the project can be deleted:
Host Health
To verify that the cluster is up and running, connect to a master instance, and run the
following:
The Ready status means that master hosts can communicate with node hosts and that the
nodes are ready to run pods (excluding the nodes in which scheduling is disabled).
DNS (Domain Name Server) resolution is the process of translating IP addresses to domain
names. When a profile is configured to look up all numeric IP addresses, Webtrends makes a
call to the network's DNS server to resolve DNS entries.
The DNS Operator implements the dns API from the operator.openshift.io API group. The
operator deploys CoreDNS using a DaemonSet, creates a Service for the DaemonSet, and
configures the kubelet to instruct pods to use the CoreDNS Service IP for name resolution.
You can create a horizontal pod autoscaler with the oc autoscale command and
specify the minimum and maximum number of pods you want to run, as well as the CPU
utilization or memory utilization your pods should target.
Bootstrap Process
Bootstrap - a temporary machine that runs a minimal Kubernetes used to deploy the
OpenShift control plane. It will be deleted at the end of the installation.
Boot strapping:
In computing, bootstrapping refers to a process where a simple system activates another more
complicated system that serves the same purpose. It is a solution to the Chicken-and-egg
problem of starting a certain system without the system already functioning. The term is most
often applied to the process of starting up a computer, in which a mechanism is needed to
execute the software program that is responsible for executing software programs (the
operating system).
In modern computers, the first program the computer runs after a hardware reset invariably is
stored in a ROM known as bootstrap ROM. as in "pulling one’s self up by the bootstraps."
Process
The bootstrap machine creates the master machines that make up the control plane. The
control plane machines then create the compute machines, which are also known as worker
machines.
After the cluster machines initialize, the bootstrap machine is destroyed. All clusters use the
bootstrap process to initialize the cluster, but if you provision the infrastructure for your
cluster, you must complete many of the steps manually.
Admission controllers?
An admission controller can intercept requests sent to the Kubernetes API server. For
example if a new pod is created a request will be sent to the Kubernetes API server and this
can be intercepted by admission controller.
An Admission Controller is a subroutine that's invoked after a request to the API is
authenticated and authorized, but before it's persisted to etcd. Admission Controller
serve the purpose of mutating and validating resources to be persisted, such as adding various
annotations and defaults and making sure that they conform to specific restrictions.
Examples:
AlwaysAdmit: This admission controller allows all pods into the cluster.
AlwaysPullImages: This admission controller modifies every new Pod to force
the image pull policy to Always.
AlwaysDeny: Rejects all requests. AlwaysDeny is DEPRECATED as no real
meaning.
CertificateApproval, CertificateSigning, ect are admission controllers
Kubectl?
The kubectl command line tool lets you control Kubernetes clusters
Namespace
Organise resources in Kubernetes. If we have DB team, monitoring team, OPS team etc., it is
better to separate all individual resources into different namespaces.
Namespaces are intended for use in environments with many users spread across multiple
teams, or projects. Namespaces provide a scope for names. Names of resources need to be
unique within a namespace, but not across namespaces. Namespaces cannot be nested inside
one another and each Kubernetes resource can only be in one namespace.
Number of nodes
Red Hat recommends a minimum of three infrastructure nodes for production
deployments. This ensures that the services have resources available and are able to migrate
in the event of host maintenance or failure.
Kubelet
The kubelet is the primary "node agent" that runs on each node. It can register the node with
the APIserver using one of: the hostname; a flag to override the hostname; or specific logic
for a cloud provider.
The kubelet works in terms of a PodSpec. A PodSpec is a YAML or JSON object that
describes a pod. Kubelet ensures that the containers described in those PodSpecs are running
and healthy.
I am terminating a node if it is stuck on docker side
What kind of PV ? trident..NFS and empty DIR
File system quota for empty dir
If I give a path of a file on OpenShift volume? How will you find which container it
belongs to
Which part hosts DNS service in OpenShift
Are you using Front end routers?
Difference between draining a node and abruptly shut down a node?
What is equivalent of kubectl ?
A particular node is unresponsive what will you do?
When tenant reports there is node issue, like multiple pods on 1 particular node are not
getting spin-up, but the same time other nodes are fine. So what will you do to
remediate the issue?
Unschedule that node and drain the node which is having issue.
Reboot a node without disturbing the pods? Steps?
How to Check health of cxd cluster?
Etcd commands
Where you check if PODS are not scaling even if you have it in deployment config ?
All pods are fine and working but the application inside it is not? (probes)
How to make sure if one particular application is reaching your pOd?
How logs are shipped from cluster to kibana?
Prometheus what is the level of work you have done?
https://www.youtube.com/watch?v=h4Sl21AKiDg&t=230s
Ansible coding experience?
What is citadel ?
who takes care of issues of master in kubernetes?
How to upgrade 4.1 to 4.3 to 4.4
Deploying openshift on IBM cloud and AWS cloud?
Prometheus and graphana?