Author | 程泽睿志 |
---|---|
Date | 2021-12-30 |
chengzeruizhi@huawei.com |
The process of starting a pod before refactoring is to create the container first, and then the network namespace is created by the container runtime. After the container is running, use the CNI plugin to configure the network namespace. This process is different from containerd's implementation, and is not compatible with secure containers. Secure containers involve communication between the virtual machine and the host, and thus require a network namespace to be available before the container can run. The existing process cannot meet this requirement, which makes it necessary to refactor the pod startup process.
The refactored pod startup process should have the following operations:
After the modification, it is required to be compatible with the security container (kata) and to ensure the existing functions.
There are three main problems during refactoring, one is how to avoid conflicts with the client's starting container process; the other is how to save the path of the namespace; the third is how to deal with resource recycling after introducing new data and files.
The solution is as follows:
Add the sandbox key as the path to the self-created network namespace in the network settings. When creating a pod, a thread creates a new file in this path and mounts the thread network space to the file to achieve persistence;
The network settings need to be dropped to prevent iSulad from restarting;
If the network mode is cni, the sandbox key should also be included in the inspect.
Timing diagram before reconstruction
Timing diagram after reconstruction
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"Bridge": {
"type": "string"
},
"SandboxID": {
"type": "string"
},
"LinkLocalIPv6Address": {
"type": "string"
},
"LinkLocalIPv6PrefixLen": {
"type": "integer"
},
"Ports": {
"$ref": "../defs.json#/definitions/mapStringObjectPortBindings"
},
"CNIPorts": {
"$ref": "../cni/anno_port_mappings.json"
},
"SandboxKey": {
"type": "string"
},
"EndpointID": {
"type": "string"
},
"Gateway": {
"type": "string"
},
"GlobalIPv6Address": {
"type": "string"
},
"GlobalIPv6PrefixLen": {
"type": "integer"
},
"IPAddress": {
"type": "string"
},
"IPPrefixLen": {
"type": "integer"
},
"IPv6Gateway": {
"type": "string"
},
"MacAddress": {
"type": "string"
},
"Activation": {
"type": "boolean"
},
"Networks": {
"$ref": "../defs.json#/definitions/mapStringObjectNetworks"
}
}
}
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )