当前位置:网站首页>Publication en niveaux de gris istio: déploiement du projet de microservice bookinfo
Publication en niveaux de gris istio: déploiement du projet de microservice bookinfo
2022-07-18 21:55:00 【Inspecteur de la qualité Foxconn Zhang quanegg】

PouristioGestion du trafic nous transférons le trafic vers différents services grâce à la publication en niveaux de gris,Vous pouvez aller à n'importe quelle configuration.Par exemple,10%Trafic vers la nouvelle version,90%Vers l'ancienne version,Ils sont tous configurables.
1、Créer un espace de noms et activer l'injection automatique
[[email protected] ~]# kubectl create ns bookinfo
namespace/bookinfo created
[[email protected] ~]# kubectl label namespace bookinfo istio-injection=enabled
namespace/bookinfo labeled[[email protected] bookinfo]# kubectl apply -f platform/kube/bookinfo.yaml -n bookinfo
service/details created
serviceaccount/bookinfo-details created
deployment.apps/details-v1 created
service/ratings created
serviceaccount/bookinfo-ratings created
deployment.apps/ratings-v1 created
service/reviews created
serviceaccount/bookinfo-reviews created
deployment.apps/reviews-v1 created
deployment.apps/reviews-v2 created
deployment.apps/reviews-v3 created
service/productpage created
serviceaccount/bookinfo-productpage created
deployment.apps/productpage-v1 created
[[email protected] bookinfo]# pwd
/root/istio-1.8.2/samples/bookinfo[[email protected] bookinfo]# kubectl apply -f networking/bookinfo-gateway.yaml -n bookinfo
gateway.networking.istio.io/bookinfo-gateway created
virtualservice.networking.istio.io/bookinfo created
[[email protected] bookinfo]# kubectl get gateway -n bookinfo
NAME AGE
bookinfo-gateway 5s
[[email protected] bookinfo]# kubectl describe gateway bookinfo-gateway -n bookinfo
Selector:
Istio: ingressgateway
Servers:
Hosts:
*
Port:
Name: http
Number: 80
Protocol: HTTP
Events: <none>[[email protected] ~]# kubectl get virtualservice -n bookinfo
NAME GATEWAYS HOSTS AGE
bookinfo [bookinfo-gateway] [*] 11h
[[email protected] ~]# kubectl describe virtualservice -n bookinfo
Spec:
Gateways:
bookinfo-gateway
Hosts:
*
Http:
Match:
Uri:
Exact: /productpage
Uri:
Prefix: /static
Uri:
Exact: /login
Uri:
Exact: /logout
Uri:
Prefix: /api/v1/products
Route:
Destination:
Host: productpage
Port:
[[email protected] ~]# kubectl get svc -n bookinfo
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
details ClusterIP 10.233.55.211 <none> 9080/TCP 11h
productpage ClusterIP 10.233.32.73 <none> 9080/TCP 11h
ratings ClusterIP 10.233.9.73 <none> 9080/TCP 11h
reviews ClusterIP 10.233.29.140 <none> 9080/TCP 11hv1 Version sans étoile

v2 Version Black Star

v3Version

Les trois versions sont maintenant disponibles .


Publication en niveaux de gris: Routage pondéré

v1Mise à jour de la version versv2Version, Préparez - le. 10%Flux, Aucun problème augmentation en pourcentage .
Le trafic est réparti uniformément après le déploiement ci - dessus. .
[[email protected] networking]# cat virtual-service-all-v1.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: productpage
spec:
hosts:
- productpage
http:
- route:
- destination:
host: productpage
subset: v1
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- route:
- destination:
host: reviews
subset: v1
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: ratings
spec:
hosts:
- ratings
http:
- route:
- destination:
host: ratings
subset: v1
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: details
spec:
hosts:
- details
http:
- route:
- destination:
host: details
subset: v1
---[[email protected] networking]# cat destination-rule-all.yaml
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: productpage
spec:
host: productpage
subsets:
- name: v1
labels:
version: v1
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: reviews
spec:
host: reviews
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
- name: v3
labels:
version: v3[[email protected] networking]# cat virtual-service-reviews-80-20.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- route:
- destination:
host: reviews
subset: v1
weight: 80
- destination:
host: reviews
subset: v2
weight: 20kubectl apply -f networking/virtual-service-reviews-90-10.yaml -n bookinfo
[[email protected] networking]# cat virtual-service-reviews-90-10.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- route:
- destination:
host: reviews
subset: v1
weight: 90
- destination:
host: reviews
subset: v2
weight: 10[[email protected] networking]# cat virtual-service-reviews-v3.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- route:
- destination:
host: reviews
subset: v3
virtualservice: Comme vous pouvez le voir ci - dessus, la publication en niveaux de gris a été ajustée en fonction des services virtuels. . Transmettre à différents sous - ensembles en fonction du poids ,C'est - à - diredestionationrule,subset hostname Pour correspondre .
destionationrule:Principalement3Versions dereviews Pour correspondre , Créer un sous - ensemble correspondant subset, Et le nommer , Les noms peuvent être choisis librement. v1 v2 v3 a b c, Tant que le service virtuel subsetEtdestionationrule Desubset Ça correspond. ,En même tempshost Ça correspond. .
Il passe par le filtre de version pod Étiquette pour filtrer ,Par exemple,version.destionationrule Est créé par le numéro de version subsetSous - ensemble.
- Sera déployé deploymentÀ l'intérieurpodAjouter une étiquetteversion: "v1",Et ça aussi.istio Points clés pour la mise en œuvre de la publication en niveaux de gris ,Basé surpodÉtiquette de, Correspond à une version différente , C'est vrai. deploymentDéploiementpodAjouter une étiquette, Les étiquettes peuvent être personnalisées ,Pour planifier.
- Déploiementdeployment Est destiné à être injecté dans istioÀ l'intérieur
- Configurer les règles de destination ,destionationrule Pour correspondre à la version de service , Pour associer la version du Service .
- Créer un service virtuel, Comment répartir le trafic ,Réaliser la publication en niveaux de gris.
Publication en niveaux de gris: Routage basé sur le contenu de la demande

Similaire àa/bTests, Échantillonnage pour certains utilisateurs , Au lieu d'une Partie aléatoire .Selonhttp Informations transportées pour compléter la distribution du trafic .
[[email protected] networking]# cat virtual-service-reviews-jason-v2-v3.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- match:
- headers:
end-user:
exact: jason
route:
- destination:
host: reviews
subset: v2
- route:
- destination:
host: reviews
subset: v3Il y a une hiérarchie. ,matchCe qui suit contientroute, L'en - tête de la requête contient jason L'utilisateur l'envoie à v2Version,En basrouteCe qui correspondmatch,Sauf quejasonEn dehors de l'utilisateur, Autres drains vers v3Version.
边栏推荐
- 2022年协同办公系统(OA系统)选型对比参考
- 机器学习笔记 - 基于Keras的GAN:图像去模糊的应用
- MySQL trigger
- Spatial attribute overview C language
- How to use mitmproxy to get data return in automated testing?
- Linux服务器上备份mysql数据库(详细教程)
- 降噪蓝牙耳机哪款好?性价比最高的主动降噪蓝牙耳机
- A risk assessment method of physical information leakage in classified places
- Multithreaded operation list
- Introduction to phabricator conduct API
猜你喜欢

如何在自动化测试中使用MitmProxy获取数据返回?
![[interview: concurrent Article 15: multithreading: synchronized optimization principle]](/img/7f/cad2c6ef98a0f56a85156c61cc9904.png)
[interview: concurrent Article 15: multithreading: synchronized optimization principle]

MySQL variables, process control and cursors

十大OA系统排行

Huawei and glory mobile phones cannot cooperate with matebook on multiple screens after upgrading the Hongmeng system
![Leetcode high frequency question: three unordered arrays a, B, C with length N, find the total number of combinations of (I, J, K) with a[i] + b[j] + c[k] = 64](/img/b0/8ed026a2fab2a3e6c95be2a6a424d9.png)
Leetcode high frequency question: three unordered arrays a, B, C with length N, find the total number of combinations of (I, J, K) with a[i] + b[j] + c[k] = 64

MySQL到底是如何执行SQL语句的

音视频中的语音信号处理都包括哪些方向?

浅学js中的关系运算符

机器学习笔记 - 基于Keras的GAN:图像去模糊的应用
随机推荐
专属资源池使用最佳实践-依赖服务使用简介
Machine learning notes - data enhancement using Gan for defect detection
阿里云、华为云、谷歌云都已入局,盘点13家云计算厂商的RPA
关于认知分析,你需要知道的一切
华为和荣耀手机升级鸿蒙系统之后与matebook无法多屏协同的问题
How to make underline style of selected items
【黄啊码】MySQL入门—2、使用数据定义语言(DDL)操作数据库
Key technologies and challenges of communication perception integration
[Huang ah code] Why do I suggest you choose go instead of PHP?
Leetcode high frequency question: three unordered arrays a, B, C with length N, find the total number of combinations of (I, J, K) with a[i] + b[j] + c[k] = 64
Caractéristiques et mode d'utilisation de la batterie ni MH (mécanisme de charge de la batterie ni MH FDK)
低代码搭建医疗企业数字化CRM案例分析
数字员工未来可期?盘点RPA在八大行业领域的应用案例
MySQL 5.7.37数据库下载安装教程(Windows无需安装版)
第四讲:圆桌座位
降噪蓝牙耳机哪款好?性价比最高的主动降噪蓝牙耳机
conda 创建删除环境
多线程操作List
哪个品牌的蓝牙耳机降噪好?主动降噪耳机排行榜10强
Blog migration from cloudbase to virtual machine