Getting started with kubernetes 2

Continue to the previous article

3.6Deployment

Deployment is a new concept introduced after 1.2 to better solve pod orchestration problems. For this reason, Deployment uses Replica Set internally to achieve the purpose. Regardless of the role and purpose of Deployment, the definition of YAML, or its specific command line operations, this is an upgrade of RC.

One of the biggest upgrades of Deployment compared to RC is that we can know the progress of the current pod deployment at any time.

Commonly used commands:

kubectl get deployments View deployment information

kubectl get rs View the corresponding Replica Set

kubectl get pods View the created pods

3.7 Horizontal Pod  Autoscaler

Pod horizontal automatic expansion We know that pod expansion and contraction can be achieved through the kubectl scale command. HPA determines whether it is necessary to adjust the number of copies of the target pod by tracking and analyzing the load changes of all target pods controlled by the specified RC. .

3.8Stateful Set

Many resource objects in k8s are for stateless services, but for some stateful services, you need to use Stateful Set, which has the following characteristics:

Each pod in the stateful set has a stable and unique network identifier, which can be used to discover other members within the cluster.

The start and stop sequence of replicas controlled by stateful set is controlled. When operating the n-th pod, n-1 pods are already running and ready.

The pods in the stateful set use stable persistent storage volumes.

3.9Service

One of the core resource objects, which defines a service access entry address. The front-end application pod accesses a set of pod cluster instances behind it through this entry. This process is realized through the label selector. The role of RC is actually to ensure that the service capability and service quality of the service always meet expected standards.

The load balancing mechanism implemented by service: each service is assigned a globally unique virtual IP address -- cluster ip, so that service invocation becomes a simple TCP network communication problem. And during the life cycle of the service, this IP will not change.

Service discovery mechanism: environment variables and subsequent DNS resolution

Load balancer solves the load balancing problem of external access to node ip + node port

3.10 Volume

A storage volume is a shared directory in a pod that can be accessed by multiple containers. The volume in kubernetes is defined on the pod, and then mounted to a specific file directory by multiple containers in a pod. The volume has the same life cycle as the pod, but is not related to the life cycle of the container.

emptyDir: Created when the pod is assigned to the node, the initial content is empty, no need to specify the corresponding directory file on the host, when the pod is removed from the node, it will be automatically deleted

hostPath: The file or directory hanging on the host on the pod.

NFS: You can define volumes of NFS type

3.11Persistent volume

PV can be understood as a piece of storage corresponding to a certain network storage in the kubernetes cluster. The difference from volume is as follows:

PV is just network storage and does not belong to any node, but can be accessed on each node.

PV is not defined on the pod, but is defined independently of the pod.

3.12Namespace

Namespace is used in many cases to implement multi-tenant resource isolation.

When Kubernetes starts, a Namespace named default will be created. If the Namespace is not specified, the pod rc service created by the user will be built into the default namespace.

If a new namespace is defined, the corresponding namespace can be specified when creating the resource object.

3.13configmap

The ConfigMap stored in etcd becomes the configuration file in the target pod through volume mapping.

Guess you like

Origin blog.csdn.net/smallbird108/article/details/105932892