Skip to content

Commit

Permalink
add blue/green
Browse files Browse the repository at this point in the history
  • Loading branch information
Clivern committed Mar 24, 2020
1 parent cafd747 commit 26d53d3
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 20 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,13 @@ $ kubectl --kubeconfig="/path/to/prod-cluster-kubeconfig.yaml" apply -f deployme
Blue/Green: release a new version alongside the old version then switch traffic.

```zsh
$ ~
$ kubectl --kubeconfig="/path/to/prod-cluster-kubeconfig.yaml" apply -f deployment/k8s/blue_green/toad_blue_green_strategy.yaml --record

# Create service to load balance the old version (blue)
$ kubectl --kubeconfig="/path/to/prod-cluster-kubeconfig.yaml" apply -f deployment/k8s/blue_green/switch_to_blue.yaml --record

# Create service to load balance the new version (green)
$ kubectl --kubeconfig="/path/to/prod-cluster-kubeconfig.yaml" apply -f deployment/k8s/blue_green/switch_to_green.yaml --record
```

Canary: release a new version to a subset of users, then proceed to a full rollout.
Expand Down
18 changes: 18 additions & 0 deletions deployment/k8s/blue_green/switch_to_blue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
apiVersion: v1
kind: Service
metadata:
name: toad-loadbalancer
labels:
app: toad
tier: backend
spec:
ports:
-
port: 80
targetPort: 8080
selector:
app: toad
tier: backend
deployment: blue # Old version
type: LoadBalancer
18 changes: 18 additions & 0 deletions deployment/k8s/blue_green/switch_to_green.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
apiVersion: v1
kind: Service
metadata:
name: toad-loadbalancer
labels:
app: toad
tier: backend
spec:
ports:
-
port: 80
targetPort: 8080
selector:
app: toad
tier: backend
deployment: green # New version
type: LoadBalancer
19 changes: 0 additions & 19 deletions deployment/k8s/blue_green/toad_blue_green_strategy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,3 @@ spec:
port: 8080
initialDelaySeconds: 10
periodSeconds: 5

---
apiVersion: v1
kind: Service
metadata:
name: toad-loadbalancer
labels:
app: toad
tier: backend
spec:
ports:
-
port: 80
targetPort: 8080
selector:
app: toad
tier: backend
deployment: blue # Old version
type: LoadBalancer

0 comments on commit 26d53d3

Please sign in to comment.