mirror of
https://github.com/acedemand/kubernetes-essentials.git
synced 2021-08-24 18:29:57 +03:00
canary
This commit is contained in:
@@ -7,4 +7,6 @@
|
||||
kubectl apply -f app-v2.yaml
|
||||
kubectl get pods -n bluegreen
|
||||
kubectl patch service my-app -n bluegreen -p '{"spec":{"selector":{"version":"v2.0.0"}}}'
|
||||
|
||||
|
||||
kubectl delete ns bluegreen
|
||||
kubectl delete pod nettools
|
||||
16
02-deployments/canary/without-istio/ReadMe
Normal file
16
02-deployments/canary/without-istio/ReadMe
Normal file
@@ -0,0 +1,16 @@
|
||||
kubectl create ns canary
|
||||
kubectl apply -f app-v1.yaml
|
||||
|
||||
kubectl run --restart=Never --image=raesene/alpine-nettools nettools
|
||||
kubectl exec -it nettools -- /bin/sh
|
||||
|
||||
while true; do curl http://my-app.canary; done
|
||||
|
||||
kubectl apply -f app-v2.yaml
|
||||
|
||||
kubectl scale deployment my-app-v2 -n canary --replicas=10
|
||||
kubectl scale deployment my-app-v1 -n canary --replicas=0
|
||||
kubectl get pods -n canary
|
||||
|
||||
|
||||
kubectl delete ns canary
|
||||
60
02-deployments/canary/without-istio/app-v1.yaml
Normal file
60
02-deployments/canary/without-istio/app-v1.yaml
Normal file
@@ -0,0 +1,60 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: my-app
|
||||
namespace: canary
|
||||
labels:
|
||||
app: my-app
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: http
|
||||
selector:
|
||||
app: my-app
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: my-app-v1
|
||||
namespace: canary
|
||||
labels:
|
||||
app: my-app
|
||||
spec:
|
||||
replicas: 10
|
||||
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: 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
|
||||
44
02-deployments/canary/without-istio/app-v2.yaml
Normal file
44
02-deployments/canary/without-istio/app-v2.yaml
Normal file
@@ -0,0 +1,44 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: my-app-v2
|
||||
namespace: canary
|
||||
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: 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
|
||||
Reference in New Issue
Block a user