当前位置:网站首页>Kubernetes' in-depth understanding of kubernetes (II) declaring organizational objects
Kubernetes' in-depth understanding of kubernetes (II) declaring organizational objects
2022-06-28 13:37:00 【Foxconn quality inspector zhangquandan】
Core technology concepts and API object

Almost all objects contain the above four categories of attributes .
TypeMeta

Java There will be package management , There will be different classes in each package , We will put classes of the same type in a package ,kubernets It's the same , For each managed object , It has one kind,kubermets The same function , These objects with the same purpose are put into one group Inside ,kind Defines what it is ,group It is a way to organize different objects .
version Is used to support api A setting for forward compatibility , Versions are evolving ,kubernets The first version of this model will be designed as v1aplpha1, It's a alpha edition , As the version evolves , It will continue to upgrade this version , If it's a demo Version of , So forever alpha The stage of ,v1alpha1->v1alpha2->v1alpha3, If you think the function is relatively mature , You can try it , Almost ready for production , It will become beta, It will become v1beta1,v1beta1->v1beta2->v1beta3, Until I think this function is ready for production , This model basically won't change , This time will turn him into v1.
So it will have continuous version evolution , But version evolution should be forward compatible , that kubernetes For each object, we added version The control of , So when an object from v1alpha1 To v1alpha2 The evolution of , In this transitional version, it will support both versions , That is to say, we can start from v1alpha1 To access it , You can also get it from v1alpha2 To access it , But in kubernetes It's inside apiserver On the level of , It has achieved conversion Methods , Used to be responsible for the conversion between different versions , So-called version It is used to control the version .
So the whole thing typemeta It defines which group an object belongs to , What kind of , Which version of , So it basically defines what the object is .
Metadata

Defines the original data of the object ,namespace Is used to place objects , Objects can pass through namespace Isolation .
Any kubernetes The objects of are divided into two categories , A class of objects like nodes , A computing node belongs to the entire cluster , Such objects are nonnamespace, its namespace The value is always empty .
The other is pod,service, All belong to a tenant / User , These objects belong to namespace.
An object namespace+name It represents the unique value in the whole cluster .
typemeta Defines what I am ,metadata Defines who I am .

An object , When we created it , Send the request for this object to apiserver,apiserver After authentication, it is stored in etcd, If you delete this object , It also goes through the same link , It finally came from etcd Delete , The deletion itself is a physical deletion , amount to etcd This data is erased , The object disappears .
If the controller is written to monitor this object , Then it will listen to the creation of this object , Once this object is created, it will do something , When the object is deleted, it will do other things , We can't believe that the system is always working , Suppose the controller is wrong , Or the controller is being upgraded , The controller is not working at this time , Delete the object at this time , Suppose the object disappears , So this event has disappeared , After this object is deleted , Then start my controller , The controller cannot see the event that this object was deleted before , Because this event has already occurred before the controller is started , When starting a new controller instance , There is no notification of this message , Therefore, the event of object deletion is lost .
therefore fanalizer It is essentially a resource lock , An object is added finalizer, Physical deletion will not be performed when deleting objects , It will do logical deletion , In fact, it is in the event stamp of its attribute deletetimestamp Set to delete the timestamp at that moment .
The advantage is that when the user deletes an object , If the object has finalzer, Then this object will not disappear , The controller can then capture the event , Even when the controller is under maintenance , Then you can see this event after restarting , When an object is found deletetimestamp Not empty , Indicates that the user wants to delete it , Then some logic processing can be done in the controller .
resourceversion
It is also a lock , In the microservice scenario, if there are multiple components to modify an object , How to ensure the access security of objects .
That is, when multiple processes modify an object , How to ensure its safety .
The first is locking , You can modify it after locking it , When other processes or threads want to access the same object, they have to wait for the lock , If you can't get the lock, it will block , What problems does this approach bring ? First of all, it is particularly safe , Secondly, many threads will block , Especially in the case of high concurrency , One gets the lock , Other people want to access the same resources , Then it needs to wait , In such a system, many processes will be blocked , So the efficiency of the whole system is low .
There is also an optimistic lock , Can you record a version information in one way , When two threads access the same object , At this time, add a version number to the object , such as v1, So all we got were from this object v1 edition , At this time, two people should modify the object at the same time , Although these two modification objects occur at the same time , But requests are sent to apiserver This end , When apiserver When this end receives the request , It must be handled first , A post-processing , It is also executed sequentially . At this time, when it processes the first request , It will see in v1 The version of , You have to update a property , This request is legal , that apiserver This request will be processed , Update this property , And change the version to v2, When processing the second request , It will also look at the version number of the second request , At present server The end version changes to v2 了 , Explain that the previous request is illegal , It is based on an old version of data , So I will refuse this request .
therefore resourceversion This is the version information , It is an optimistic lock , It maintains the version information of the object , When each component wants to modify the same object, it should bring the version , from apiserver To determine whether it is modified based on the latest version , If not, refuse , If so, accept , In this way, multiple components can modify the same object in an unlocked state .
apiserver Rejected a request , Then the client is obliged to get the latest version and try again , In this case, the system is running in an unlocked state .

When querying objects, you can use the tag filter to query .

spec and status

spec It's user input , That is what I expect you to be .
Every object has a controller ,status It is configured by the controller , Write back to this object after the configuration is completed ,status It is controlled by the controller .
Commonly used Kubernetes Objects and groups

You can see that different objects are placed in different group Inside , The core business is supported by core/v1 Inside , Application management needs to be done in apps/v1.
边栏推荐
- Talk about exception again -- what happens when an exception is thrown?
- G1垃圾收集器中重要的配置参数及其默认值
- You must configure either the server or JDBC driver (via the ‘serverTimezone‘ configuration property
- How about stock online account opening and account opening process? Is it safe to open a mobile account?
- Successful cases of rights protection of open source projects: successful rights protection of SPuG open source operation and maintenance platform
- Make an ink screen electronic clock, cool!
- Complete backpack beginner chapter "suggestions collection"
- Mature case and source code of hash quiz game system development technology
- CodeBlocks MinGW installation configuration problem
- 我呕血收集融合了来自各路经典shell书籍的脚本教学,作为小白的你快点来吧
猜你喜欢

初识exception

FH511+TP4333组成一个户外移动电源照明野营灯方案。

Stm32f1 and stm32cubeide programming example - matrix keyboard driver

To be the Italian Islander? Liuqiangdong cashed out 6.6 billion yuan in two months and made a one-time 560million "emergency transfer" to buy the European maritime Palace

CVPR再起争议:IBM中稿论文被指照搬自己承办竞赛第二名的idea

Writing skills of resume

New product experience: Alibaba cloud's new generation of local SSD instance I4 open beta

ShareIt has outstanding strength and landed in the top 7 of the global IAP strength list

MySQL multi table joint query

Other domestic mobile phones failed to fill the vacancy of Huawei, and apple has no rival in the high-end mobile phone market
随机推荐
华泰证券开户怎么开 怎么办理开户最安全
Vscode shortcut key
Mobile web training day-2
Matlab plotyy coordinate axis setting, [reprint] example of MATLAB plotyy drawing double ordinate graph [easy to understand]
List集合转数组
plt.savefig()的用法以及保存路径
Forecast and Analysis on market scale and development trend of China's operation and maintenance security products in 2022
Writing skills of resume
If a programmer goes to prison, will he be assigned to write code?
Arduino-ESP32闪存文件插件程序搭建和上传
Professional English calendar questions
Setup and upload of arduino-esp32 flash file plug-in program
股票网上开户及开户流程怎样?手机开户是安全么?
Arcgis 矢量中心点生成矩形并裁剪tif图像进行深度学习样本训练
单元测试 CI/CD
PostgreSQL surpasses MySQL
完全背包 初学篇「建议收藏」
How to open an account on the flush? Is it safe
You must configure either the server or JDBC driver (via the ‘serverTimezone‘ configuration property
众昂矿业着眼氟化工产业,布局新能源产业链