Kubernetes infrastructure-The cloud-native container beyond an operational application (APP)
Kubernetes infrastructure is the incorporation of
resources (including servers, physical or virtual machines, cloud platforms and
more) that support Kubernetes environment. It is also known as ‘K8s’ or ‘Kube’.
It is the child of the 15 years of experience of running production workloads at google, combined by the best-of-breed ideas and practice from the commodity.
Kubernetes deals with the containers or hosts, that
provides mechanisms for deployment (that consists of several interrelated
activities with possible transitions between software components), application
scaling and maintenance.
Today,
Kubernetes and the broader container ecosystem are maturing into a
general-purpose computing platform and ecosystem that rivals — if not surpasses
— virtual machines (VMs) as the basic building blocks of modern cloud
infrastructure and applications. This ecosystem enables organizations to
deliver a high-productivity Platform-as-a-Service (PaaS) that
addresses multiple infrastructure-related and operations-related tasks and
issues surrounding cloud-native development so that development teams
can focus solely on coding and innovation.
Structure
and architecture of Kubernetes Cluster
A Kubernetes
cluster consists of a control plane (master), a distributed
storage system for keeping the cluster state consistent (etcd),
and a number of cluster nodes (Kubelets).
Control plane
(master)
·
API Server:
- The Kubernetes API server validates and
configures the data for pods, services, and replication controllers. It also
assigns pods to nodes and synchronizes pod information with service
configuration.
·
etcd: - etcd stores the persistent master state
while other components watch etcd for changes to bring themselves
into the desired state. etcd can be optionally configured for high
availability, typically deployed with 2n+1 peer services.
·
Controller
Manager Server: - The controller
manager server watches etcd for changes to replication
controller objects and then uses the API to enforce the desired state.
·
Pacemaker: - Optional, used when
configuring highly-available masters.
Pacemaker is
the core technology of the High Availability Add-on for Red Hat Enterprise
Linux, providing consensus, fencing, and service management. It can be run on
all master hosts to ensure that all active-passive components have one instance
running.
·
Virtual IP:- Optional, used when
configuring highly-available masters.
The virtual
IP (VIP) is the single point of contact, but not a single point of failure, for
all OpenShift clients that:
a) Cannot be configured with all master
service endpoints, or
b) do not know how to load balance across
multiple masters nor retry failed master service connections.
There is one
VIP and it is managed by Pacemaker.
High Availability
Masters
You can optionally configure your
masters for high availability (HA) to ensure that the cluster has no single
point of failure.
To mitigate concerns about availability
of the master, two activities are recommended:
- A runbook entry should be
created for reconstructing the master. A runbook entry is a necessary
backstop for any highly-available service. Additional solutions merely
control the frequency that the runbook must be consulted. For example, a
cold standby of the master host can adequately fulfill SLAs that require
no more than minutes of downtime for creation of new applications or
recovery of failed application components.
- Use a high availability solution to
configure your masters and ensure that the cluster has no single point of
failure. The advanced installation method provides specific
examples using Pacemaker as the management technology, which Red
Hat recommends. However, you can take the concepts and apply them towards
your existing high availability solutions.
Cluster Nodes
Cluster nodes are machines that run
containers and are managed by the master nodes. The Kubelet is
the primary and most important controller in Kubernetes. It’s
responsible for driving the container execution layer, typically Docker.
What is Docker?
Docker is the most popular tool
for creating and running Linux containers. While early forms of containers were
introduced decades ago (with technologies such as FreeBSD Jails and AIX
Workload Partitions), containers were democratized in 2013 when Docker brought
them to the masses with a new developer-friendly and cloud-friendly
implementation.
Pods and Services
Pods are one of the crucial concepts
in Kubernetes, as they are the key construct that developers interact
with. The previous concepts are infrastructure-focused and internal
architecture.
There are various
types of pods:
- Replica Set, the default, is a relatively simple
type. It ensures the specified number of pods are running
- Deployment is a declarative way of managing
pods via Replica Sets. Includes rollback and rolling update mechanisms
- Daemon set is a way of ensuring each node will
run an instance of a pod. Used for cluster services, like health
monitoring and log forwarding
- Stateful Set is tailored to managing pods that
must persist or maintain state
- Job and CronJob run short-lived jobs as a one-off
or on a schedule.
Kubernetes
Services
Services are the Kubernetes way of
configuring a proxy to forward traffic to a set of pods. Instead of static IP
address-based assignments, Services use selectors (or labels) to define which
pods uses which service. These dynamic assignments make releasing new versions
or adding pods to a service really easy. Anytime a Pod with the same labels as
a service is spun up, it’s assigned to the service.
By default, services are only
reachable inside the cluster using the cluster IP service type. Other service
types do allow external access; the Load Balancer type is the
most common in cloud deployments. It will spin up a load balancer per service
on the cloud environment, which can be expensive. With many services, it can
also become very complex.
To solve that complexity and cost,
Kubernetes supports Ingress, a high-level abstraction governing how
external users access services running in a Kubernetes cluster using host- or
URL-based HTTP routing rules.
Kubernetes
Networking
Networking Kubernetes has a
distinctive networking model for cluster-wide, pod to-pod networking. In most
cases, the Container Network Interface (CNI) uses a simple
overlay network (like Flannel) to obscure the underlying network from the pod
by using traffic encapsulation (like VXLAN); it can also use a fully-routed
solution like Calico. In both cases, pods communicate over a cluster-wide pod
network, managed by a CNI provider like Flannel or Calico.
Within a pod, containers can
communicate without any restrictions. Containers within a pod exist within the
same network namespace and share an IP. This means containers can communicate
over localhost. Pods can communicate with each other using the pod IP address,
which is reachable across the cluster.
Kubernetes
Tooling and Clients:
Here are the basic tools you should
know:
- Kubeadm bootstraps a cluster. It’s designed to be a simple way
for new users to build clusters (more detail on this is in a later
chapter).
- Kubectl is a tool for interacting with your existing cluster.
- Minikube is a tool that makes it easy to run
Kubernetes locally. For Mac users, HomeBrew makes using Minikube even
simpler.
There’s also a graphical dashboard,
Kube Dashboard, which runs as a pod on the cluster itself. The dashboard is
meant as a general-purpose web frontend to quickly get an impression of a given
cluster
Kubernetes
Resource Limits: Kubernetes Capacity Planning
Capacity planning is a critical step
in successfully building and deploying a stable and cost-effective
infrastructure. The need for proper resource planning is amplified within a
Kubernetes cluster, as it does hard checks and will kill and move workloads
around without hesitation and based on nothing but current resource usage.
This article will highlight areas that are important to consider, such as: how many Daemon Sets are deployed, if a service mesh is involved, and if quotas are being actively used. Focusing on these areas when capacity planning makes it much easier to calculate the minimum requirements for a cluster that will allow everything to run.
Kubernetes
Cluster Sizing – How Large Should a Kubernetes Cluster Be?
When it comes to Kubernetes clusters,
size matters. The number of nodes in your cluster plays an important role in
determining the overall availability and performance of your workloads. So does
the number of namespaces, in a way.
This does not mean, however, that
bigger is always better. A Kubernetes cluster sizing strategy that aims to
maximize node count will not always deliver the best results – certainly not
from a cost perspective, and perhaps not from an overall availability or
performance perspective, either. And maximizing namespaces is hardly ever a
smart strategy.
Instead, calculating the number of
nodes to include in a cluster requires careful consideration of a variety of
factors. Keep reading for an overview – if not a precise recommendation on how
large your cluster should be, because only you can decide that for yourself.
Conclusion
We have gone over the architecture of
the Kubernetes-based cloud native infrastructure. As we have seen above,
various tools address different problems with infrastructure. They are like
Lego blocks, each focusing on a specific problem at hand, abstracting away a
lot of complexity for you.
This allows users to leverage
Kubernetes in an incremental fashion rather than getting on board all at once,
using just the tools you need from the entire stack depending on your use case.
Comments
Post a Comment