当前位置:网站首页>Grayscale publishing through ingress
Grayscale publishing through ingress
2022-06-11 06:52:00 【[email protected]】
1、 Deploy Deployment V1 application
Create as follows YAML file (app-v1.yaml)
apiVersion: v1
kind: Service
metadata:
name: my-app-v1
labels:
app: my-app
spec:
ports:
- name: http
port: 80
targetPort: http
selector:
app: my-app
version: v1.0.0
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app-v1
labels:
app: my-app
spec:
replicas: 1
selector:
matchLabels:
app: my-app
version: v1.0.0
template:
metadata:
labels:
app: my-app
version: v1.0.0
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9101"
spec:
containers:
- name: my-app
image: registry.cn-hangzhou.aliyuncs.com/containerdemo/containersol-k8s-deployment-strategies
ports:
- name: http
containerPort: 8080
- name: probe
containerPort: 8086
env:
- name: VERSION
value: v1.0.0
livenessProbe:
httpGet:
path: /live
port: probe
initialDelaySeconds: 5
periodSeconds: 5
readinessProbe:
httpGet:
path: /ready
port: probe
periodSeconds: 5
Execute the following command to deploy Deployement V1 application :
kubectl apply -f app-v1.yaml
Create as follows Ingress YAML file (ingress-v1.yaml)
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-app
labels:
app: my-app
spec:
rules:
- host: my-app-22e6541b324bd1dfe04a48beb40046ea.ca2ef983cc3a64042a32c1a423d32021e.cn-shanghai.alicontainer.com
http:
paths:
- backend:
serviceName: my-app-v1
servicePort: 80
path: /
Execute the following command to deploy Ingress resources
kubectl apply -f ingress-v1.yaml
Pass... After deployment curl Command to test :
curl my-app-22e6541b324bd1dfe04a48beb40046ea.ca2ef983cc3a64042a32c1a423d32021e.cn-shanghai.alicontainer.com
You will see the following return :
Host: my-app-v1-68bfcbb7cf-w4rpg, Version: v1.0.0
2、 Deploy Deployment V2 application
Create as follows YAML file (app-v2.yaml)
apiVersion: v1
kind: Service
metadata:
name: my-app-v2
labels:
app: my-app
spec:
ports:
- name: http
port: 80
targetPort: http
selector:
app: my-app
version: v2.0.0
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app-v2
labels:
app: my-app
spec:
replicas: 1
selector:
matchLabels:
app: my-app
version: v2.0.0
template:
metadata:
labels:
app: my-app
version: v2.0.0
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9101"
spec:
containers:
- name: my-app
image: registry.cn-hangzhou.aliyuncs.com/containerdemo/containersol-k8s-deployment-strategies
ports:
- name: http
containerPort: 8080
- name: probe
containerPort: 8086
env:
- name: VERSION
value: v2.0.0
livenessProbe:
httpGet:
path: /live
port: probe
initialDelaySeconds: 5
periodSeconds: 5
readinessProbe:
httpGet:
path: /ready
port: probe
periodSeconds: 5
Execute the following command to deploy Deployement V2 application :
kubectl apply -f app-v2.yaml
3、 According to the weight strategy, the gray scale is reduced to Deployment V2 application
Create as follows Ingress YAML file (ingress-v2-canary-weigth.yaml)
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-app-canary
labels:
app: my-app
annotations:
# Enable canary and send 10% of traffic to version 2
nginx.ingress.kubernetes.io/canary: "true"
nginx.ingress.kubernetes.io/canary-weight: "10"
spec:
rules:
- host: my-app-22e6541b324bd1dfe04a48beb40046ea.ca2ef983cc3a64042a32c1a423d32021e.cn-shanghai.alicontainer.com
http:
paths:
- backend:
serviceName: my-app-v2
servicePort: 80
path: /
Execute the following command to deploy Ingress resources
kubectl apply -f ingress-v2-canary-weigth.yaml
Execute the following command to test :
while sleep 0.1;do curl my-app-22e6541b324bd1dfe04a48beb40046ea.ca2ef983cc3a64042a32c1a423d32021e.cn-shanghai.alicontainer.com; done
The test results are as follows :
Host: my-app-v1-68bfcbb7cf-w4rpg, Version: v1.0.0
Host: my-app-v1-68bfcbb7cf-w4rpg, Version: v1.0.0
Host: my-app-v1-68bfcbb7cf-w4rpg, Version: v1.0.0
Host: my-app-v1-68bfcbb7cf-w4rpg, Version: v1.0.0
Host: my-app-v1-68bfcbb7cf-w4rpg, Version: v1.0.0
Host: my-app-v1-68bfcbb7cf-w4rpg, Version: v1.0.0
Host: my-app-v1-68bfcbb7cf-w4rpg, Version: v1.0.0
Host: my-app-v1-68bfcbb7cf-w4rpg, Version: v1.0.0
Host: my-app-v1-68bfcbb7cf-w4rpg, Version: v1.0.0
Host: my-app-v2-67c69b8857-g82gr, Version: v2.0.0
Host: my-app-v1-68bfcbb7cf-w4rpg, Version: v1.0.0
4、 according to Header Policy grayscale to Deployment V2 application
Create as follows Ingress YAML file (ingress-v2-canary-header.yaml)
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-app-canary
labels:
app: my-app
annotations:
# Enable canary and send traffic with headder x-app-canary to version 2
nginx.ingress.kubernetes.io/canary: "true"
nginx.ingress.kubernetes.io/canary-by-header: "x-app-canary"
nginx.ingress.kubernetes.io/canary-by-header-value: "true"
spec:
rules:
- host: my-app-22e6541b324bd1dfe04a48beb40046ea.ca2ef983cc3a64042a32c1a423d32021e.cn-shanghai.alicontainer.com
http:
paths:
- backend:
serviceName: my-app-v2
servicePort: 80
Execute the following command to deploy Ingress resources
kubectl apply -f ingress-v2-canary-header.yaml
adopt curl Command to test the application :
curl my-app-22e6541b324bd1dfe04a48beb40046ea.ca2ef983cc3a64042a32c1a423d32021e.cn-shanghai.alicontainer.com
give the result as follows :
At present, the environment is still v1
Host: my-app-v1-68bfcbb7cf-w4rpg, Version: v1.0.0
Execute the following command to publish all grayscale environments to v2
curl my-app-22e6541b324bd1dfe04a48beb40046ea.ca2ef983cc3a64042a32c1a423d32021e.cn-shanghai.alicontainer.com -H "x-app-canary: true"
give the result as follows
Host: my-app-v2-67c69b8857-g82gr, Version: v2.0.0
版权声明
本文为[[email protected] micro fatty]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206110649304443.html
边栏推荐
- Throttling and anti shake
- Handwriting promise [02] - asynchronous logic implementation
- 网狐游戏服务器房间配置向导服务定制功能页实现
- [MATLAB image encryption and decryption] chaotic sequence image encryption and decryption (including correlation test) [including GUI source code 1862]
- Moment time plug-in tips -js (super detailed)
- 关于组织开展2022年宁波市重点首版次软件申报工作的通知
- JS two methods to determine whether there are duplicate values in the array
- 【Matlab WSN通信】A_Star改进LEACH多跳传输协议【含源码 487期】
- Difference between foreach, for... In and for... Of
- The nearest common ancestor of 235 binary search tree
猜你喜欢

Latex various arrows / arrows with text labels / variable length arrows

迅为干货 |瑞芯微RK3568开发板TFTP&NFS烧写(上)

The realization of online Fox game server room configuration battle engagement customization function

争议很大的问题

100. 相同的树

Redux learning (II) -- encapsulating the connect function
![[]==![]](/img/65/ab724c74b080da319ed5c01c93fdb7.png)
[]==![]

Biweekly investment and financial report: capital rush yuan universe game

Check whether the filing information of the medical representative is correct
![JS implementation of graphic merging and sorting process [source code attached]](/img/c8/210ddab791eb2319519496f7c7d010.jpg)
JS implementation of graphic merging and sorting process [source code attached]
随机推荐
The difference between TCP and UDP
How exactly does instanceof judge the reference data type!
572. 另一个树的子树
Heartless sword Chinese English bilingual poem 001 Love
About daily report plan
347. top k high frequency elements
JS implementation of Hill sort of graphic insertion sort [with source code]
[matlab WSN communication] a_ Star improved leach multi hop transmission protocol [including source code phase 487]
Check whether the filing information of the medical representative is correct
socket. IO cross domain stepping pit
UEFI finding PCI devices
saltstack部署lnmp
021 mongodb database from getting started to giving up
搜狐员工遭遇工资补助诈骗 黑产与灰产有何区别 又要如何溯源?
Handwritten promise [05] - exception capture of promise method and optional parameters of then method implementation
How to make time planning
Pytest自动化测试-简易入门教程(01)
Count the time-consuming duration of an operation (function)
Array information management system reconfiguration preheating (1) how to write basic logic using linear continuous structure?
河南高考VS天津高考(2008年-2021年)