k8s of pod

A, Pod classification

Autonomous Pod:
Management Controller Pod: Kubernetes more advanced abstraction layer called the Controller to manage Pod instance. Each Pod has a special called "Root Container" Pause a container.
 
Pod of relations with controllers
• controllers: object management and operation of container on a cluster
• The label-selector associated
• Pod achieved through the application controller operation and maintenance, such as stretching, upgrades, etc.
 
Two, Pod container classification
• Infrastructure Container: basic maintenance of the entire container • Pod cyberspace
• InitContainers: • Initialization container prior to the container business started
• Containers: • container business started in parallel
 
Three, Pod survival of detection (health check)
Probe There are two types:
livenessProbe: indicate whether the container is running. If the survival of the probe fails, kubelet will kill container and the container will be affected by the restart of its strategy. If the container does not provide a viable probe, the default status of Success.
readinessProbe: indicate whether the container is ready to service requests. If the probe fails ready, the endpoint controller will match the Pod Service endpoint of all remove the IP address of the Pod. Ready state before the initial delay default Failure. If the container is not ready to provide the probe, the default status of Success.
 
Probe supports the following three methods:
httpGet HTTP request, returns a successful status code range 200-400.
Shell exec execute command returns a status code of 0 is successful.
tcpSocket
Initiate TCP Socket successfully established.
 
Four, Pod resource constraints
Container resource request and Pod and limitations:
• spec.containers[].resources.limits.cpu
• spec.containers[].resources.limits.memory
• spec.containers[].resources.requests.cpu
• spec.containers[].resources.requests.memory
 
Five, Pod resource scheduling
 
There are three stages in which the scheduling process: the preselected node, preferably the node, the selected node to select the best node.
 
Node pre: pre-selected based on a set of rules for each check node, the nodes that do not match the filter conditions, thereby completing the preselected nodes
Preferably nodes: node preselected prioritize, to select the most appropriate target operation node Pod
Selected nodes: pick the highest priority node from the priority ranking Pod operation result, when more than one such node, the random selection
When we want to have certain requirements Pod run on a specific resource node, we can match specific combination of pre-selected by the policy node label, and the label or tag selector Pod and scheduling is done, such as MatchInterPodAfinity, MatchNodeSelector, PodToleratesNodeTaints other preselected policies, which is commonly used to provide users Pod affinity or anti-affinity and affinity-based stains and node scheduling mechanism to customize tolerance.
 
Six, Pod Controller Controllers
• Deployment: Stateless application deployment
• StatefulSet: stateful application deployment
• DaemonSet: Ensure that all run the same Node Pod
 
2.Deployment: work on ReplicaSet, stateless application for managing, at present, the best controller. Support rolling updates and rollbacks function, it also provides declarative configuration.
 
Deployment for the Pod and Replica Set (Next Generation Replication Controller) provides a declarative update.
Only you need to describe what you want in the state is the target Deployment, Deployment controller will help you to Pod and the actual state ReplicaSet changes to your target state. You can also define a new Deployment ReplicaSet to create or delete an existing Deployment and create a new one to replace.
 
3.DaemonSet: to ensure that each node in the cluster is running only a copy of a particular pod, typically used to implement system-level background task. For example ELK service
Characteristics: The service is stateless
Services must be Daemon
 
DaemonSet sure to run a copy of the Pod on all (or some) Node. When Node joins the cluster will add a Pod for them. When a Node is removed from the cluster, the Pod will be recovered. Delete DaemonSet Pod will delete all its created.
 
Deployment
• Deploying stateless applications
• Management Pod and ReplicaSet
• With the deployment of on-line, copies set, rolling upgrade, rollback and other functions • To provide declarative updates, such as updating only a new Image
Application scenarios: Web Services
 
SatefulSet
• applications deployed state
• solve Pod independent life cycle, to maintain order and uniqueness Pod start
1. stable, unique network identifier, persistent storage
2. orderly, elegant deploy and extend, delete and termination
3. orderly rollover
Scenario: Database
 
SatefulSet
StatefulSet differs Deployment:! Identity of the identity of three elements:
• Domain Name
• CPU name
• Storage (PVC)
 
Headless Service (headless Service) is used to generate a resolvable identifier DNS resource records Pod.
volumeClaimTemplates (template storage volume application) based on a static or dynamic manner to provide PV is supplied as a proprietary fixed Pod storage resources.
StatefulSet, Pod for resource control.
 
There are two state of the cluster service needs, is a storage requirements. Another is the clustering requirements.
Storage needs, Kubernetes solution is Volume, Persistent Volume. For PV, PV pool in addition to creating a manual, but also can make storage systems Storage Class is automatically created.
Cluster needs, Kubernetes solution is Pet Set. Pet Set and do a cluster initialized by Init Container, to provide a stable network identity for the cluster members through Headless Service.

 

Guess you like

Origin www.cnblogs.com/muzinan110/p/11105828.html