Getting Started with Kubernetes | Pods and Container Design Modes

1) Why Pods Are Needed

The Concept Behind Containers

Example of a Real Operating System

The Concept Behind Process Groups

The Pod as a Process Group

Reason for Using a Pod as an Atomic Unit of Scheduling

  • Why is a pod abstracted as a concept?
  • Is it possible to solve the problem by scheduling without pods?
  • Why must a pod be an atomic unit of scheduling in Kubernetes?

What Is a Pod?

  • Files are exchanged between processes. In the preceding example, one process writes logs while the other reads logs.
  • Both processes need to communicate with each other through the localhost or the local socket. This local communication is referred to as a super affinity.
  • Both containers and microservices require frequent RPC calls. In this case, a super affinity is required between them for improved performance.
  • Two containers or applications need to share some Linux namespaces. For example, adding one container to the network namespace of another container to view the network device and network information of the latter container.

2) Pod Implementation Mechanism

Issues that Pods Resolve

3) Container Design Pattern

Example

  • Method 1: Pack the WAR package and Tomcat into an image. However, the image actually contains two objects. In this case, whether to update the WAR package or Tomcat, recreating an image is mandatory.
  • Method 2: Pack only Tomcat into an image. The image contains only Tomcat but needs to use data volumes, such as hostPath, to mount the WAR package from the host to the webapps directory in the Tomcat container. In this way, the container is used after startup.

Init Container

Sidecar

  • Some tasks to be executed by SSH in a container, such as scriptwriting and condition presetting, are completed by the Init Container or Sidecar.
  • Another typical example is log collection. Log collection is a process and also a container that is packaged into a pod for collection.
  • Another important application is the Debug application. This application defines a small container in a pod to execute the namespace of the pod.
  • Sidecar also checks the working status of other containers. There”s no need to log on to the container through SSH. Instead, install the monitoring component in a small container and start the container as Sidecar to cooperate with the main business container. In this case, business monitoring is implemented by Sidecar.

Summary

  • Pods are the core mechanism for implementing the container design mode in Kubernetes.
  • The container design mode is one of the best practices for managing large-scale container clusters in Google Borg, as well as one of the basic dependencies for the complex application orchestration of Kubernetes.
  • For all design modes, the essence is decoupling and reuse.
  • View the backup plan.

Original Source:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

4.97K Followers

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com