Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HoldApplicationUntilProxyStart #142

Open
njy17 opened this issue Sep 12, 2023 · 0 comments
Open

HoldApplicationUntilProxyStart #142

njy17 opened this issue Sep 12, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@njy17
Copy link
Contributor

njy17 commented Sep 12, 2023

sidecar的启动和业务容器的启动顺序存在依赖关系,kubelet拉起pod内的多容器并不能保证envoy就绪后再启动主容器,这会导致主容器在启动时因为envoy未就绪而失败,虽然我们可以通过提高代码的健壮性例如循环调用等方法来解决这个问题,但也应该有比较通用型的解决方法

调整顺序,envoy和polaris-sidecar的顺序在主容器之前并且在确保envoy ready后再启动业务容器,envoy v1.26.2的官方文档有:15000/ready可以用来当作envoy的readiness探针,参考istio的旧版解决方法,在sidecar注入时在poststart中假如等待envoyreadiness探针返回200再启动业务容器
add.Lifecycle = &corev1.Lifecycle{
PostStart: &corev1.LifecycleHandler{
Exec: &corev1.ExecAction{
Command: []string{"/bin/bash", "-c", "while (($(curl -s -o /dev/null -w ''%{http_code}'' 127.0.0.1:15000/ready) !="200")); do echo Waiting for Sidecar;sleep 1; done;"},
},
},
}

@njy17 njy17 added the enhancement New feature or request label Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant