当前位置:网站首页>Concepts of kubernetes components
Concepts of kubernetes components
2022-06-24 21:12:00 【The smell of tobacco】
Preface
Kubernetes There are too many concepts in , what PodServiceDeployment Etc., etc. , I was blindfolded by the people I just touched . Through a few days of observation , Tell me about my understanding of each component .
This article only gives a brief introduction to these concepts , Not to be confused when reading other articles later .
Node
Node Well understood. . Is an instance of the actual operation of the service , It could be a physical machine , It can also be a VM virtual machine
Pod
docker All used , That's the container. . and Pod In fact, it's similar to docker-composer, Multiple associated containers form a Pod. Let's say I have a nginx Container and a php-fpm The container of , The two of them can be combined into one Pod`.

In the same Pod in , Different containers share network stacks and storage volumes . in other words , nginx visit php-fpm You can use it directly localhost:9000 that will do , in other words , One Pod Start two containers in , All occupied 80 port , Can't start successfully . Sharing is through Pause Containers Realized , Here is a brief introduction to the concept , It doesn't unfold .
Pod controller
stay Kubernetes in , Pod It is the smallest unit of resources . And this pile of controllers , It's used to deal with Pod For automatic management . Of course , If you do not use the controller but manage it manually, it is not impossible , Just tired . such as :
- management
PodThe number of - Realization
PodElastic expansion of - monitor
PodThe state of - Start and release regularly
Pod - wait
In order to meet different needs , There is a difference Pod controller . The following controllers only implement different requirements , It's just a matter of time .
ReplicationController
Yes Pod Quantity management . Make sure Pod Keep the quantity at the user-defined quantity . ( If the container exits abnormally , Automatically create new Pod. If the number is large , It will also be recycled automatically . ) But now it is recommended to use ReplicaSet Replaced the .

ReplicaSet
and ReplicationController It's about the same , An additional set selector Support for ( tag chooser ).
although ReplicaSet Can be used alone , But recommended Deployment Conduct management .
Deployment
Deployment Will not directly manage Pod, It's through management ReplicaSet, Re Jingyou ReplicaSet management Pod.
Deployment Handled a lot ReplicaSet Unsupported additional actions . Such as :
- rolling-update ( Scroll to update ) And rollback
- Automatic telescopic ( Expand and shrink )
- Pause and resume
- wait
By the way , Deployment Hot update of , By creating a new ReplicaSet, Gradually reduce the original ReplicaSet in Pod Number and add new ReplicaSet in Pod Quantity to achieve . Rollback is the reverse .

HorizontalPodAutoscaler
HPA Will not directly manage Pod, It's management Deployment perhaps ReplicaSet.
HPA It can detect Pod Resource utilization , Such a scenario can be realized : When Pod CPU The utilization rate is greater than 80 Automatically create a new , Otherwise, it will be released automatically . Started at the same time Pod The largest number 30 individual , least 5 individual . It can realize the horizontal expansion of services .
StatefulSet
StatefulSet To solve the problem of stateful service . The above controllers are stateless . StatefulSet The following functions can be realized :
- Stable persistent storage . When
PodAfter dynamic adjustment, the same persistent data can be accessed . be based onPVCRealization - Stable network identity .
PodAfter dynamic adjustmentPodNameHostNameunchanged . be based onHeadless ServiceRealization . - Orderly deployment . Previous
PodSuccessful launch , To create the nextPod. Solve the problem of service dependency . be based oninit containersRealization . - In order to delete . Reverse operation of orderly deployment .
DeamonSet
Can ensure that all ( Or a designated part of )Node All run one Pod copy . When new Node When you join a cluster, you will automatically add the corresponding Pod, When Node When removing from a cluster , Corresponding Pod It will also be recycled .
This runs in Node Medium Pod What's the use ? For example, resource monitoring , Another example is log collection .
Job
Batch task . kubernetes One or more of this task can be guaranteed Pod A successful ending , If the task fails , kubernetes It will restart automatically , Until success .
CronJob
Job Of crontab edition . Based on time management Job. By creating... At a specific time Job Realized . You can run a task at a specified time , Or run periodically at a specified time .
Service discovery and load balancing
Service
Pod The controller is just for Pod Management of , Like in one Deployment Running on 5 individual Pod, If external access Pod The service is written for every Pod The address of , When Pod When scaling dynamically , Maintaining these addresses is a big problem .
and Service It is to solve this problem that . It's a group of Pod It provides a unified external interface , External access Service Re Jingyou Service Send the request to Pod, Without concern Pod The number of 、 start-up 、 Release and so on .
meanwhile Service It can also load balance the traffic

Ingress
because Service Four layer load balancing , In other words, it can only be represented to IP layer , Can't achieve something like nginx Load balancing according to different domain names and different paths . In order to solve this problem Ingress, Ingress It forwards requests independently of other services . It can be understood as Service Of Service.
Generally speaking , adopt Service Yes Pod Internal agency , And then through Ingress Forward the request to Service. Ingress There are also different implementations , And one of the more commonly used is ingress-nginx 了 , Its configuration file is similar to nginx. Officially maintained . The start command is :
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.0/deploy/static/provider/cloud/deploy.yaml
Official documents : https://kubernetes.github.io/ingress-nginx/

Storage volume
This demand is very common , Used to store and mount data . In different containers 、 And different pod To share .
The specific usage can be seen : https://hujingnb.com/archives/709
ConfigMap
Dedicated to storing configuration files , It also supports binary content . Write the contents of the file directly to yaml Configuration in progress . meanwhile , ConfigMap It supports hot update .
Secret
Store some information that needs to be encrypted , Like keys 、 Password etc. . It is basically the same as ConfigMap almost , The difference is ConfigMap The content is encrypted on the basis of . But, uh , At this stage Secret The encryption method of is base64? This is also called encryption ? It can only be counted as coding .
By command : kubectl get secrets secret-name -o yaml View content .
however , The community should introduce more secure encryption policies in the future .
in addition , For private image repositories , Secret You can add authentication information when you pull an image .
volume
In the same pod Storage volumes are shared among multiple containers under , It's like mounting a disk . volume No separate kind, Is defined directly .
Above , Yes Kubernetes The names in are briefly introduced , Go back to other articles , Is it much clearer . It's all about managing all aspects and levels of the container .
Link to the original text : https://hujingnb.com/archives/706
边栏推荐
- DAPP system customization of full chain hash game (scheme design)
- Simpledateformat thread unsafe
- Web automation: web control interaction / multi window processing / Web page frame
- Packaging_ Conversion between basic type and string type
- 浅谈MySql update会锁定哪些范围的数据
- Physical layer introduction
- Background of master data construction
- Web automation: summary of special scenario processing methods
- Steps of JMeter performance test
- Can the OPDS SQL component pass process parameters to the next component through context
猜你喜欢

Realization of truth table assignment by discrete mathematical programming

Network flow 24 questions (round table questions)

Curl command

Procedural life: a few things you should know when entering the workplace

Simple analysis of WordPress architecture

After idea installs these plug-ins, the code can be written to heaven. My little sister also has to arrange it

传统的IO存在什么问题?为什么引入零拷贝的?

Vant component used in wechat applet

Grating diffraction

After a few years in the testing industry, do you still know a little?
随机推荐
Basic properties and ergodicity of binary tree
The difference between RPC and restful
Basic concepts and definitions of Graphs
Memo mode - game archiving
Minimum cost and maximum flow (template question)
Leetcode (146) - LRU cache
JMeter installation plug-in, adding [email protected] -Perfmon metric collector listener steps
Use the transparent [x] cross button image in the dialog
Adding subscribers to a list using mailchimp's API V3
Difference between map and object
Why do we always "give up halfway"?
Berkeley, MIT, Cambridge, deepmind et d'autres grandes conférences en ligne: vers une IA sûre, fiable et contrôlable
Basic database syntax learning
Hongxiang Yunteng is compatible with dragon lizard operating system, and the product runs stably
Variable setting in postman
Rename and delete files
Leetcode (135) - distribute candy
DHCP operation
List set Introduction & common methods
Dijkstra seeking secondary short circuit (easy to understand)