当前位置:网站首页>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
边栏推荐
- SQL query. Only the column name is displayed but not the data
- latex 各种箭头/带文字标号的箭头/可变长箭头
- How exactly does instanceof judge the reference data type!
- LEARNING TARGET-ORIENTED DUAL ATTENTION FOR ROBUST RGB-T TRACKING
- 3.1 naming rules of test functions
- Array information management system reconfiguration preheating (1) how to write basic logic using linear continuous structure?
- fatal: refusing to merge unrelated histories
- Stack -- one of two common linear structures of linear structure
- NPM upgrade: unable to load file c:\users\administrator\appdata\roaming\npm\npm-upgrade ps1
- Do you use typescript or anyscript
猜你喜欢

100. 相同的树

ESP32学习笔记(49)——ESP-WIFI-MESH接口使用

核查医药代表备案信息是否正确

Simple integration of client go gin six list watch two (about the improvement of RS, pod and deployment)

socket. IO cross domain stepping pit

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

Deep Attentive Tracking via Reciprocative Learning

About the designer of qtcreator the solution to the problem that qtdesigner can't pull and hold controls normally

235-二叉搜索树的最近公共祖先

saltstack部署lnmp
随机推荐
争议很大的问题
Differences between FindIndex and indexof
[MATLAB image encryption and decryption] chaotic sequence image encryption and decryption (including correlation test) [including GUI source code 1862]
latex 各种箭头/带文字标号的箭头/可变长箭头
ESP32学习笔记(49)——ESP-WIFI-MESH接口使用
Scripy web crawler series tutorials (I) | construction of scripy crawler framework development environment
JS judge whether the year is a leap year and the number of days in the month
Post exam summary
617. merge binary tree
A highly controversial issue
河南高考VS天津高考(2008年-2021年)
sql查询问题,只显示列名 不显示数据
Simple integration of client go gin six list watch two (about the improvement of RS, pod and deployment)
During unity panoramic roaming, AWSD is used to control lens movement, EQ is used to control lens lifting, and the right mouse button is used to control lens rotation.
迅为干货 |瑞芯微RK3568开发板TFTP&NFS烧写(上)
[matlab printed character recognition] OCR printed letter + number recognition [including source code 1861]
instanceof到底是怎样判断引用数据类型的!
双周投融报:资本抢滩元宇宙游戏
Illustration of JS implementation from insertion sort to binary insertion sort [with source code]
关于 QtCreator的设计器QtDesigner完全无法正常拽托控件 的解决方法