Basic concepts of Kubernetes

Basic concepts of Kubernetes

What are Containers?

No alt text provided for this image

Containers are a form of operating system virtualization. A single container might be used to run anything from a small microservice or software process to a larger application. Inside a container are all the necessary executables, binary code, libraries, and configuration files. Compared to server or machine virtualization approaches, however, containers do not contain operating system images. This makes them more lightweight and portable, with significantly less overhead. In larger application deployments, multiple containers may be deployed as one or more container clusters. Such clusters might be managed by a container orchestrator such as Kubernetes.

Benefits of containers

Containers are a streamlined way to build, test, deploy, and redeploy applications on multiple environments from a developer’s local laptop to an on-premises data center and even the cloud. Benefits of containers include:

  • Less overhead
  • Containers require less system resources than traditional or hardware virtual machine environments because they don’t include operating system images.
  • Increased portability
  • Applications running in containers can be deployed easily to multiple different operating systems and hardware platforms.
  • More consistent operation
  • DevOps teams know applications in containers will run the same, regardless of where they are deployed.
  • Greater efficiency
  • Containers allow applications to be more rapidly deployed, patched, or scaled.
  • Better application development
  • Containers support agile and DevOps efforts to accelerate development, test, and production cycles.

What is Kubernetes/k8s?

To begin to understand the usefulness of Kubernetes, we have to first understand two concepts: immutable infrastructure and containers.

No alt text provided for this image

  • Immutable infrastructure?is a practice where servers, once deployed, are never modified. If something needs to be changed, you never do so?directly on the server. Instead, you’ll build a new server from a base image, that have all your needed changes baked in. This way we can simply replace the old server with the new one without any additional modification.
  • Containers?offer a way to package code, runtime, system tools, system libraries, and configs altogether. This shipment is a lightweight, standalone executable. This way, your application will behave the same every time no matter where it runs (e.g, Ubuntu, Windows, etc.). Containerization is not a new concept, but it has gained immense popularity with the rise of microservices and Docker.

Armed with those concepts, we can now?define?Kubernetes as a container or microservice platform that orchestrates computing, networking, and storage infrastructure workloads. Because it doesn’t limit the types of apps you can deploy (any language works), Kubernetes extends how we scale containerized applications so that we can enjoy all the benefits of a truly immutable infrastructure. The general rule of thumb for K8S: if your app fits in a container, Kubernetes will deploy it.

By the way, if you’re wondering where the name “Kubernetes” came from, it is a Greek word, meaning helmsman or pilot. The abbreviation K8s is derived by replacing the eight letters of “ubernete” with the digit 8.

The Kubernetes Project was open-sourced by Google in 2014 after using it to run production workloads at scale for more than a decade. Kubernetes provides the ability to run dynamically scaling, containerised applications, and utilising an API for management. Kubernetes is a vendor-agnostic container management tool, minifying cloud computing costs whilst simplifying the running of resilient and scalable applications.

Kubernetes has become the standard for running containerised applications in the cloud, with the main Cloud Providers (AWS, Azure, GCE, IBM and Oracle) now offering managed Kubernetes services.

What are PODS?

No alt text provided for this image

A single or group of containers that share storage and network with a Kubernetes configuration, telling those containers how to behave. Pods share IP and port address space and can communicate with each other over localhost networking. Each pod is assigned an IP address on which it can be accessed by other pods within a cluster. Applications within a pod have access to shared volumes – helpful for when you need data to persist beyond the lifetime of a pod.

What are Node?

No alt text provided for this image
What are Node?

  • A (normally) Virtual host(s) on which containers/pods are run.
  • Nodes are machine, they can be physical, on-prem or virtual cloud machines.
  • A node can have multiple pods.

What are Clusters?

No alt text provided for this image

  • Cluster are considered as set of nodes that run containerized application.
  • Each cluster will have at least one worker node.?


What is Namespace?

No alt text provided for this image

Namespaces are a way to create multiple virtual Kubernetes clusters within a single cluster. Namespaces are normally used for wide scale deployments where there are many users, teams and projects.



What are service?

No alt text provided for this image


  • Coupling of a set of pods to a policy by which to access them. Services are used to expose containerized applications to origins from outside the cluster.
  • Services allow us to define how to access pods over the network.
  • Types of service available: ClusterIP, LoadBalancer, NodePort, ExternalName.
  • Service helps us in providing a stable IP address, loadbalancing

What is Ingress?

Ingress?exposes HTTP and HTTPS routes from outside the cluster to?services?within the cluster. Traffic routing is controlled by rules defined on the Ingress resource.

No alt text provided for this image

Kubernetes architecture, components and benefits?

A K8S cluster is made of a master node, which exposes the API, schedules deployments, and generally manages the cluster. Multiple worker nodes can be responsible for container runtime, like?Docker?or?rkt, along with an agent that communicates with the master.

No alt text provided for this image

Master components

These master components comprise a master node:

  • Kube-apiserver.?Exposes the API.
  • Etcd.?Key value stores all cluster data. (Can be run on the same server as a master node or on a dedicated cluster.)
  • Kube-scheduler.?Schedules new pods on worker nodes.
  • Kube-controller-manager.?Runs the controllers.
  • Cloud-controller-manager.?Talks to cloud providers.

Node components

  • Kubelet.?Agent that ensures containers in a pod are running.
  • Kube-proxy.?Keeps network rules and perform forwarding.
  • Container runtime.?Runs containers.

What benefits does Kubernetes offer?

Out of the box, K8S provides several key features that allow us to run immutable infrastructure. Containers can be killed, replaced, and self-heal automatically, and the new container gets access to those support?volumes,?secrets,?configurations, etc., that make it function.

These key K8S features make your containerized application scale efficiently:

Horizontal scaling:- Scale your application?as needed?from command line or UI.
Automated rollouts and rollbacks:- Roll out changes that monitor the health of your application—ensuring all instances don’t fail or go down simultaneously. If something goes wrong, K8S automatically rolls back the change.
Service discovery and load balancing:- Containers get their own IP so you can put a set of containers behind a single DNS name for load balancing.
Storage orchestration:- Automatically mount local or public cloud or a network storage.
Secret and configuration management:- Create and update secrets?and configs without rebuilding your image.
Self-healing:- The platform heals many problems: restarting failed containers, replacing and rescheduling containers as nodes die, killing containers that don’t respond to your user-defined health check, and waiting to advertise containers to clients until they’re ready.
Batch execution:- Manage your batch and Continuous Integration workloads and replace failed containers.
Automatic binpacking:- Automatically schedules containers based on resource requirements and other constraints.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了