You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/pt/docs/concepts/containers/container-lifecycle-hooks.md
+25-23Lines changed: 25 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,50 +28,52 @@ This hook is executed immediately after a container is created.
28
28
However, there is no guarantee that the hook will execute before the container ENTRYPOINT.
29
29
No parameters are passed to the handler.
30
30
31
+
Este _hook_ é executado imediatamente após um contêiner ser criado.
32
+
Entretanto, não há garantia que o _hook_ será executado antes do ENTRYPOINT do contêiner.
33
+
Nenhum parâmetro é passado para o manipulador.
34
+
31
35
`PreStop`
32
36
33
-
This hook is called immediately before a container is terminated due to an API request or management
34
-
event such as a liveness/startup probe failure, preemption, resource contention and others. A call
35
-
to the `PreStop` hook fails if the container is already in a terminated or completed state and the
36
-
hook must complete before the TERM signal to stop the container can be sent. The Pod's termination
37
+
The Pod's termination
37
38
grace period countdown begins before the `PreStop` hook is executed, so regardless of the outcome of
38
39
the handler, the container will eventually terminate within the Pod's termination grace period. No
39
40
parameters are passed to the handler.
40
41
41
42
A more detailed description of the termination behavior can be found in
42
43
[Termination of Pods](/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination).
43
44
44
-
### Hook handler implementations
45
+
Esse _hook_ é chamado imediatamente antes de um contêiner ser encerrado devido a uma solicitação de API ou um gerenciamento de evento como liveness/startup probe failure, preemption, resource contention e outros.
46
+
Uma chamada ao _hook_`PreStop` falha se o contêiner já está em um estado finalizado ou concluído e o _hook_ deve ser concluído antes que o sinal TERM seja enviado para parar o contêiner.
47
+
48
+
49
+
### Implementações de manipulador de hook
45
50
46
-
Containers can access a hook by implementing and registering a handler for that hook.
47
-
There are two types of hook handlers that can be implemented for Containers:
51
+
Os contêineres podem acessar um _hook_ implementando e registrando um manipulador para esse _hook_.
52
+
Existem dois tipos de manipuladores de _hooks_ que podem ser implementados para contêineres:
48
53
49
-
* Exec - Executes a specific command, such as `pre-stop.sh`, inside the cgroups and namespaces of the Container.
50
-
Resources consumed by the command are counted against the Container.
51
-
* HTTP - Executes an HTTP request against a specific endpoint on the Container.
54
+
* Exec - Executa um comando específico, como `pre-stop.sh`, dentro do cgroups e Namespaces do contêiner.
55
+
* HTTP - Executa uma requisição HTTP em um endpoint específico do contêiner.
52
56
53
-
### Hook handler execution
57
+
### Execução do manipulador de hook
54
58
55
-
When a Container lifecycle management hook is called,
56
-
the Kubernetes management system execute the handler according to the hook action,
57
-
`httpGet` and `tcpSocket` are executed by the kubelet process, and `exec` is executed in the container.
58
59
59
-
Hook handler calls are synchronous within the context of the Pod containing the Container.
60
-
This means that for a `PostStart` hook,
61
-
the Container ENTRYPOINT and hook fire asynchronously.
62
-
However, if the hook takes too long to run or hangs,
63
-
the Container cannot reach a `running` state.
60
+
Quando um _hook_ de gerenciamento de ciclo de vida do contêiner é chamado, o sistema de gerenciamento do Kubernetes executa o manipulador de acordo com a ação do _hook_, `httpGet` e `tcpSocker` são executados pelo processo kubelet e `exec` é executado pelo contêiner.
64
61
65
-
`PreStop` hooks are not executed asynchronously from the signal to stop the Container; the hook must
66
-
complete its execution before the TERM signal can be sent. If a `PreStop` hook hangs during
67
-
execution, the Pod's phase will be `Terminating` and remain there until the Pod is killed after its
68
-
`terminationGracePeriodSeconds` expires. This grace period applies to the total time it takes for
62
+
As chamadas do manipulador do _hook_ são síncronas no contexto do Pod que contém o contêiner.
63
+
Isso significa que para um _hook_`PostStart`, o ENTRYPOINT do contêiner e o _hook_ disparam de forma assíncrona.
64
+
No entanto, se o _hook_ demorar muito para ser executado ou travar, o contêiner não consegue atingir o estado `running`.
65
+
66
+
This grace period applies to the total time it takes for
69
67
both the `PreStop` hook to execute and for the Container to stop normally. If, for example,
70
68
`terminationGracePeriodSeconds` is 60, and the hook takes 55 seconds to complete, and the Container
71
69
takes 10 seconds to stop normally after receiving the signal, then the Container will be killed
72
70
before it can stop normally, since `terminationGracePeriodSeconds` is less than the total time
73
71
(55+10) it takes for these two things to happen.
74
72
73
+
Os _hooks_`PreStop` não são executados de forma assíncrona a partir do sinal para parar o conêiner, o _hook_ precisa finalizar a sua execução antes que o sinal TERM possa ser enviado.
74
+
Se um _hook_`PreStop` travar durante a execução, a fase do Pod será `Terminating` e permanecerá até que o Pod seja morto após seu `terminationGracePeriodSeconds` expirar.
0 commit comments