Uploaded by Dhyey

kubernet

advertisement
Kubernetes
Kubernetes Terminology,
Kubernetes Features ,Kubernetes Pods, Kubernetes Cluster Model
,
Kubernetes
• Kubernetes in an open source container
management tool hosted by Cloud Native
Computing Foundation (CNCF). This is also known
as the enhanced version of Borg which was
developed at Google to manage both long
running processes and batch jobs, which was
earlier handled by separate systems. Kubernetes
comes with a capability of automating
deployment, scaling of application, and
operations of application containers across
clusters. It is capable of creating container centric
infrastructure.
Following are some of the important
features of Kubernetes
•
•
•
•
•
Continues development, integration and deployment
Containerized infrastructure
Application-centric management
Auto-scalable infrastructure
Environment consistency across development testing
and production
• Loosely coupled infrastructure, where each component
can act as a separate unit .
• Higher density of resource utilization
• Predictable infrastructure which is going to be created
• One of the key components of Kubernetes is,
it can run application on clusters of physical
and virtual machine infrastructure. It also has
the capability to run applications on cloud. It
helps in moving from host-centric
infrastructure to container-centric
infrastructure.
Kubernetes ─ Architecture
• As seen in the following diagram, Kubernetes
follows client-server architecture. Wherein,
we have master installed on one machine and
the node on separate Linux machines.
• Kubernetes uses a cluster architecture. A Kubernetes
cluster comprises many control planes and one or
more physical or virtual machines called “worker
nodes.” The worker nodes host Pods, which contain
one or more containers.
• A container is a runtime environment containing a
software package and all its dependencies. Container
images are standalone collections of the executable
code and content that are used to populate a container
environment as illustrated in the following figure:
Kubernetes terminology
• The control plane makes decisions about the cluster.
This includes scheduling containers to run,
detecting/responding to failures, and starting new
Pods when the number of replicas listed in a
Deployment file is unsatisfied. The following logical
components are all part of the control plane
• Controller manager – Monitors the Kubernetes cluster
to detect and maintain several aspects of the
Kubernetes environment including joining Pods to
services, maintaining the correct number of Pods in a
set, and responding to the loss of nodes
•
Cloud controller manager – An optional component used for cloudbased deployments. The cloud controller interfaces with the cloud service
provider (CSP) to manage load balancers and virtual networking for the
cluster.
•
Kubernetes application programming interface (API) server – The
interface through which administrators direct Kubernetes. As such, the API
server is typically exposed outside of the control plane. It is designed to
scale and may exist on multiple control plane nodes.
• Etcd® – The persistent backing store where all information regarding the
state of the cluster is kept. Etcd is not intended to be manipulated directly
but should be managed through the API server.
• Scheduler – Tracks the status of worker nodes and determines where to
run Pods. Kube-scheduler is intended to be accessible only from within the
control plane.
• Kubernetes worker nodes are physical or virtual
machines dedicated to running containerized
applications for the cluster. In addition to running
a container engine, worker nodes host the
following two services that allow orchestration
from the control plane:
• Kubelet – Runs on each worker node to
orchestrate and verify Pod execution.
• Kube-proxy – A network proxy that uses the
host’s packet filtering capability to ensure correct
packet routing in the Kubernetes cluster.
• Clusters are commonly hosted using a CSP
Kubernetes service or an on-premises Kubernetes
service; CSPs often provide additional features.
They administer most aspects of managed
Kubernetes services; however, organizations may
need to handle some Kubernetes service aspects,
such as authentication and authorization,
because default CSP configurations are typically
not secure. When designing a Kubernetes
environment, organizations should understand
their responsibilities in securely maintaining the
cluster.
Kubernetes Pods
• with kubernetes our ultimate aim is to deploy
our application in the form of containers on a
set of machines that are configured as worker
nodes in a cluster. However, kubernetes does
not deploy containers directly on the worker
nodes. The containers are encapsulated into a
Kubernetes object known as PODs. A POD is a
single instance of an application. A POD is the
smallest object, that you can create in
kubernetes
• Here we see the simplest of simplest cases were you have a
single node kubernetes cluster with a single instance of
your application running in a single docker container
encapsulated in a POD. What if the number of users
accessing your application increase and you need to scale
your application? You need to add additional instances of
your web application to share the load. Now, were would
you spin up additional instances? Do we bring up a new
container instance within the same POD? No! We create a
new POD altogether with a new instance of the same
application. As you can see we now have two instances of
our web application running on two separate PODs on the
same kubernetes system or node.
• What if the user base FURTHER increases and your current
node has no sufficient capacity? Well THEN you can always
deploy additional PODs on a new node in the cluster. You
will have a new node added to the cluster to expand the
cluster’s physical capacity. SO, what I am trying to illustrate
in this slide is that, PODs usually have a one-to-one
relationship with containers running your application. To
scale UP you create new PODs and to scale down you
delete PODs. You do not add additional containers to an
existing POD to scale your application. Also, if you are
wondering how we implement all of this and how we
achieve load balancing between containers etc, we will get
into all of that in a later lecture.
What is a Kubernetes cluster model?
• A Kubernetes cluster is a collection of linked node
machines. These are the machines on which the containers
run. They are virtual machines if the cluster is running in
the cloud, though they can be physical machines if the
cluster is run on-premise.
• Kubernetes cluster includes at least one master node and,
for production, at least one worker node (but ideally a
minimum of three).
• As the primary control unit for the Kubernetes cluster, the
master node handles the Kubernetes control plane – the
environment via which the worker nodes interact with the
master node. The control plane exposes the Kubernetes API
so the nodes and the containers that host your application
can be managed by Kubernetes.
• this sparks the question - is Kubernetes a pod
or cluster? Each worker node hosts one or
more pods – a collection of containers under
Kubernetes’ control. The various workloads
and services that make up your cloud
application run in these containers. Crucially,
the containers are not tied to their node
machines. Kubernetes can move them around
the cluster if necessary to maximize stability
and efficiency.
The key components of a Kubernetes
cluster
• components of a Kubernetes cluster can be
grouped according to whether they run on the
master node or the worker nodes. The master
node is sometimes referred to simply as the
control plane. It maintains the desired state of
the cluster, covering which applications are
running and which container images their
various components are running on.
• Master node components
• Etcd Storage is a key-value data store that can be accessed by all
nodes in the cluster. It stores configuration data about the cluster’s
state.
• Kube-API-Server responds to requests from the worker nodes. It
receives REST requests for modifications and also serves as a frontend to control clusters.
• Kube-scheduler monitors resource utilization across the cluster and
schedules pods of containers accordingly. It also decides where
services will be deployed.
• Kube-controller-manager runs a number of distinct controller
processes in the background, regulating the shared state of the
cluster and performing routine tasks. When there is a change to a
service, the controller recognizes the change and initiates an
update to bring the cluster up to the desired state.
• worker node components
• The Kubelet monitors all containers in the node, continually
checking they are running and that they remain in a healthy state.
Integrated into the kubelet binary is a piece of software called
cAdvisor, that auto-discovers all containers and collects CPU,
memory, file system, and network usage statistics and also provides
machine usage stats by analyzing the ‘root’ container.
• Kube Proxy acts as a network proxy and a load balancer, while also
forwarding requests to the correct pods.
• As a collection of related containers, a pod is the basic Kubernetes
building block. A pod shares network/storage between its
containers and also a specification for how to run the containers.
Each pod typically has an internal cluster IP address.
• Containers represent the smallest unit. They live inside pods and
need external IP addresses to view outside processes.
\
WHAT is Kubernetes cluster
management?
• Kubernetes cluster management is the process of managing
a Kubernetes cluster from the moment of deployment
onwards. Key to the success of Kubernetes has been its
ability to automate much of this work – and central to that
ability is the principle of a ‘desired state’.
• Kubernetes is a declarative system, which means that
rather than issue specific instructions, you provide it with
information that describes the desired state of the cluster,
usually in the form of one or more YAML files. Kubernetes
will then manage the cluster automatically. If it detects a
change – if a container fails, for example – it will perform
the necessary actions to return the cluster to that desired
state.
REFERENCE LINK
• https://www.weave.works/blog/kubernetescluster
• https://kubernetes.io/docs/concepts/clusteradministration/networking/
• https://kubernetes.io/docs/reference/kubectl
/
Download