当前位置:网站首页>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
边栏推荐
- 2021-05-02: given the path of a file directory, write a function
- Is Guotai Junan Futures safe? How to open a futures account? How to reduce the futures commission?
- Using oasis to develop a hop by hop (I) -- Scene Building
- MySQL date timestamp conversion
- Reference to junit5 test framework in gradle
- Some experiences of project K several operations in the global template
- 对深度可分离卷积、分组卷积、扩张卷积、转置卷积(反卷积)的理解
- MySQL Advanced Series: locks - locks in InnoDB
- 2021-05-04: given a non negative integer C, you need to judge whether there are two integers a and B, so that a*a+b*b=c.
- Summer Challenge harmonyos - to do list with date effect
猜你喜欢

打破内存墙的新利器成行业“热搜”!持久内存让打工人也能玩转海量数据+高维模型
![[interview high frequency questions] sequential DP questions with difficulty of 3/5 and direct construction](/img/32/720ffa63a90cd5d37460face3fde38.png)
[interview high frequency questions] sequential DP questions with difficulty of 3/5 and direct construction

60 divine vs Code plug-ins!!

【附下载】汉化版Awvs安装与简单使用

Understanding openstack network

日志记录真没你想的那么简单

Nifi from introduction to practice (nanny level tutorial) - environment

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

How to easily realize online karaoke room and sing "mountain sea" with Wang Xinling
![Software test [high frequency] interview questions sorted out by staying up late (latest in 2022)](/img/33/2c2256fd98b908ddaf5573f644ad7f.png)
Software test [high frequency] interview questions sorted out by staying up late (latest in 2022)
随机推荐
PyTorch中的转置卷积详解
[log service CLS] Tencent cloud log4j/logback log collection best practices
山金期货安全么?期货开户都是哪些流程?期货手续费怎么降低?
Fastjson 漏洞利用技巧
Cap: multiple attention mechanism, interesting fine-grained classification scheme | AAAI 2021
期货怎么开户安全些?哪些期货公司靠谱些?
Two problems of qtreewidget returning as DLL in singleton mode
找出隐形资产--利用Hosts碰撞突破边界
60 个神级 VS Code 插件!!
Remain true to our original aspiration
How to expand disk space on AWS host
[cloud native | kubernetes chapter] Introduction to kubernetes Foundation (III)
Is Shanjin futures safe? What are the procedures for opening futures accounts? How to reduce the futures commission?
Summary of common tools and usage
Nature publishes significant progress in quantum computing: the first quantum integrated circuit implementation in history
How to select an open source license
Easy installation of Jenkins
Step by step import RHEL image to Tencent cloud
#夏日挑战赛# HarmonyOS - 实现带日期效果的待办事项
MySQL Innodb和Myisam