当前位置:网站首页>Istio FAQ: sidecar startup sequence
Istio FAQ: sidecar startup sequence
2022-06-24 16:15:00 【imroc】
This article excerpts from istio Learning notes
background
Some services are going istio In the process of migration and transition , Sometimes you may meet Pod Boot failure , Then keep restarting , The reason for troubleshooting is that other services need to be called during business startup ( For example, pull the configuration from the configuration center ), If you fail, quit , There is no retry logic . The reason why the call failed is envoy Not ready yet (envoy It is also necessary to pull the configuration from the control surface , It will take a little time ), The traffic sent by the service cannot be processed , So the call fails ( Reference resources k8s issue #65502 ).
Best practices
The current best practice for this kind of problem is to make the application more robust , Add retry logic , Don't quit immediately after the call fails , If it is troublesome to change , You can also add... Before starting the command sleep, Wait a few seconds ( It may not be very elegant ).
If you don't want to make any changes to the application , You can also refer to the following evasion scheme .
Avoid scheme : adjustment sidecar Injection sequence
stay istio 1.7, Community through to istio-injector The injection logic adds a called HoldApplicationUntilProxyStarts To solve this problem , When the switch is on ,proxy Will be injected into the first container.
see istio-injector Automatic injection uses template, You can know that if you open HoldApplicationUntilProxyStarts Will be for sidecar Add one postStart hook:
Its purpose is to block the subsequent business container startup , Wait until the sidecar Start the business container after it is fully started .
This switch configuration is divided into global and local , Here are the enabling methods .
Global configuration :
modify istio Of configmap Global configuration :
kubectl -n istio-system edit cm istio
stay defaultConfig Lower join holdApplicationUntilProxyStarts: true
apiVersion: v1
data:
mesh: |-
defaultConfig:
holdApplicationUntilProxyStarts: true
meshNetworks: 'networks: {}'
kind: ConfigMap If you use IstioOperator,defaultConfig modify CR Field meshConfig:
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
namespace: istio-system
name: example-istiocontrolplane
spec:
meshConfig:
defaultConfig:
holdApplicationUntilProxyStarts: trueLocal configuration :
If you use istio 1.8 And above , It can be used for Pod add proxy.istio.io/config annotation , take holdApplicationUntilProxyStarts Set as true, Example :
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
annotations:
proxy.istio.io/config: |
holdApplicationUntilProxyStarts: true
labels:
app: nginx
spec:
containers:
- name: nginx
image: "nginx"It should be noted that , When you turn on this switch , This means that the business container needs to wait sidecar Completely ready Before starting , Will make Pod Start slower . It may be difficult to cope with sudden traffic scenarios when rapid capacity expansion is required , So the suggestion is to evaluate the business scenario by yourself , Using the method of local configuration , Only turn on this switch for the business you need .
Perfect plan : K8S Support container dependency
The most perfect solution is Kubernetes Self support container dependencies , The community also proposed Sidecar Container Characteristics of , Unfortunately, it was finally abandoned , The new plan has not yet been implemented , Details available This note .
Reference material
边栏推荐
- Here comes Wi Fi 7. How strong is it?
- Fastjson vulnerability utilization techniques
- Several common DoS attacks
- Database tools in intelij can connect but cannot display schema, tables
- Global and Chinese market of inverted syrup 2022-2028: Research Report on technology, participants, trends, market size and share
- One article explains Jackson configuration information in detail
- 2021-04-28: force buckle 546, remove the box. Give some boxes of different colors
- ZOJ——4104 Sequence in the Pocket(思维问题)
- Step by step import RHEL image to Tencent cloud
- Software test [high frequency] interview questions sorted out by staying up late (latest in 2022)
猜你喜欢

C. Three displays(动态规划)Codeforces Round #485 (Div. 2)
MySQL進階系列:鎖-InnoDB中鎖的情况
MySQL Advanced Series: locks - locks in InnoDB

一文详解JackSon配置信息

C. Three displays codeforces round 485 (Div. 2)

Solution of intelligent all in one machine in expressway service area

构建Go命令行程序工具链

用 Oasis 开发一个跳一跳(一)—— 场景搭建

Understanding openstack network

使用阿里云RDS for SQL Server性能洞察优化数据库负载-初识性能洞察
随机推荐
几种常见的DoS攻击
Is Guotai Junan Futures safe? How to open a futures account? How to reduce the futures commission?
CAP:多重注意力机制,有趣的细粒度分类方案 | AAAI 2021
I just came back from the Ali software test. I worked for Alibaba P7 in 3+1, with an annual salary of 28*15
【应用推荐】最近大火的Apifox & Apipost 上手体验与选型建议
MySQL Advanced Series: locks - locks in InnoDB
Remain true to our original aspiration
一文详解JackSon配置信息
How to open a futures account safely? Which futures companies are more reliable?
MySQL development specification
Istio FAQ: region awareness does not take effect
Golang+redis distributed mutex
我与“Apifox”的网络情缘
April 30, 2021: there are residential areas on a straight line, and the post office can only be built on residential areas. Given an ordered positive array arr
Efficient tools commonly used by individuals
The catch-up of domestic chips has scared Qualcomm, the leader of mobile phone chips in the United States, and made moves to cope with the competition
[my advanced OpenGL learning journey] learning notes of OpenGL coordinate system
2021-04-29: given an array arr, it represents a row of balloons with scores. One for each blow
用 Oasis 开发一个跳一跳(一)—— 场景搭建
Nifi from introduction to practice (nanny level tutorial) - environment