apiVersion: v1
kind: Namespace
metadata:
name: dev
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: dev
spec:
selector:
matchLabels:
app: nginx
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: wangweicoding-docker.pkg.coding.net/nginx-ingress-gray/docker/nginx
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx
namespace: dev
spec:
ports:
- name: tcp-80-80
port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
sessionAffinity: None
type: NodePort
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx # nginx=nginx-ingress| qcloud=CLB ingress
## kubernetes.io/ingress.subnetId: subnet-xxxxxxxx # if qcloud, should give subnet
name: my-ingress
namespace: dev
spec:
rules:
- host: nginx-ingress.coding.dev
http:
paths:
- backend:
serviceName: nginx
servicePort: 80
path: /
apiVersion: v1
kind: Namespace
metadata:
name: pro
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: pro
spec:
selector:
matchLabels:
app: nginx
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: wangweicoding-docker.pkg.coding.net/nginx-ingress-gray/docker/nginx
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx
namespace: pro
spec:
ports:
- name: tcp-80-80
port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
sessionAffinity: None
type: NodePort
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx # nginx=nginx-ingress| qcloud=CLB ingress
## kubernetes.io/ingress.subnetId: subnet-xxxxxxxx # if qcloud, should give subnet
name: my-ingress
namespace: pro
spec:
rules:
- host: nginx-ingress.coding.pro
http:
paths:
- backend:
serviceName: nginx
servicePort: 80
path: /
apiVersion: v1
kind: Namespace
metadata:
name: pro
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-canary
namespace: pro
spec:
selector:
matchLabels:
app: nginx-canary
replicas: 1
template:
metadata:
labels:
app: nginx-canary
spec:
containers:
- name: nginx
image: wangweicoding-docker.pkg.coding.net/nginx-ingress-gray/docker/nginx
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx-canary
namespace: pro
spec:
ports:
- name: tcp-80-80
port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx-canary
sessionAffinity: None
type: NodePort
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx # nginx=nginx-ingress| qcloud=CLB ingress
## kubernetes.io/ingress.subnetId: subnet-xxxxxxxx # if qcloud, should give subnet
nginx.ingress.kubernetes.io/canary: "true"
nginx.ingress.kubernetes.io/canary-by-header: "location"
nginx.ingress.kubernetes.io/canary-by-header-value: "shenzhen"
#nginx.ingress.kubernetes.io/canary-weight: 100
name: my-ingress
namespace: pro
spec:
rules:
- host: nginx-ingress.coding.pro
http:
paths:
- backend:
serviceName: nginx-canary
servicePort: 80
path: /