Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(feat): K8s blue/green deployment from Spinnaker #1858

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Kubernetes Guides for Spinnaker and Armory CD
linkTitle: Kubernetes Guides
description: >
This section contains Kubernetes-specific guides for non-admin users of Spinnaker and Armory Continuous Deployment.
---
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
---
title: Automated Kubernetes Rollbacks in Spinnaker
linkTitle: Automated Kubernetes Rollbacks
aliases:
- /spinnaker/automated_rollbacks/
- /docs/spinnaker/automated-rollbacks/
linkTitle: Automated Rollbacks
description: >
Learn how to rollback Kubernetes deployments from Spinnaker based on complexity and number of artifacts deployed.
Learn how to use Spinnaker to rollback Kubernetes deployments based on complexity and number of artifacts deployed.
aliases:
- /spinnaker-user-guides/automated-rollbacks/
---

## Creating a main deployment pipeline
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
title: Deploy a Docker Image to Kubernetes
linkTitle: Deploy a Docker Image to Kubernetes
aliases:
- /spinnaker/kubernetes_deployments/
- /docs/spinnaker/kubernetes-deployments/
linkTitle: Deploy a Docker Image
description: >
Learn how to use Spinnaker's Kubernetes V2 provider to deploy your Docker image.
aliases:
- /spinnaker-user-guides/kubernetes-deployments/
---

## Kubernetes Deployments
## Kubernetes deployments
Spinnaker delegates the deployment of containers to Kubernetes. Kubernetes then proceeds with a rolling update deployment which is effectively a rolling blue/green deployment.
Pods are created in batches and when a pod is deemed [healthy](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/) it starts receiving traffic.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
---
title: Deploy Applications to Kubernetes
# This is different from user-guides/kubernetes - no redirect
aliases:
- /spinnaker_user_guides/kubernetes-v2/
- /spinnaker_user_guides/kubernetes_v2/
- /spinnaker-user-guides/kubernetes_v2/
title: Use Spinnaker to Deploy Apps to Kubernetes
linkTitle: Deploy Apps
description: >
Learn how to use Spinnaker's Kubernetes V2 provider to deploy your applications.
aliases:
- /spinnaker-user-guides/kubernetes-v2/
---

## Overview of Spinnaker's Kubernetes V2 Provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
title: Use Kustomize for Manifest-Based Kubernetes Deployments in Spinnaker
linkTitle: Use Kustomize for App Manifests
linkTitle: Kustomize App Manifests
description: >
Learn how to use Kustomize within your Spinnaker pipeline to generate a custom Kubernetes deployment manifest artifact. You can use this artifact in a downstream stage to deploy your application.
aliases:
- /spinnaker-user-guides/kustomize-manifests/
---

## Overview of Kustomize
Expand Down
49 changes: 49 additions & 0 deletions content/en/includes/cdsh/user/bluegreen/deployment-blue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: blue-index-html
data:
index.html: |
<html>
<body bgcolor=blue>
<marquee behavior=alternate>
<font face=arial size=6 color=white>
!!! Welcome to Nginx Blue Deployment !!!
</font>
</marquee>
</body>
</html>

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
version: blue
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
volumeMounts:
- mountPath: /usr/share/nginx/html/index.html # mount index.html to /usr/share/nginx/html/index.html
subPath: index.html
readOnly: true
name: index-html
volumes:
- name: index-html
configMap:
name: blue-index-html # place ConfigMap `index-html` on /usr/share/nginx/html/index.html
items:
- key: index.html
path: index.html
51 changes: 51 additions & 0 deletions content/en/includes/cdsh/user/bluegreen/deployment-green.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: green-index-html
data:
index.html: |
<html>
<body bgcolor=green>
<marquee behavior=alternate>
<font face=arial size=6 color=white>
!!! Welcome to Nginx Green Deployment !!!
</font>
</marquee>
</body>
</html>

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
annotations:
traffic.spinnaker.io/load-balancers: '["service nginx"]'
spec:
selector:
matchLabels:
app: nginx
replicas: 2 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: nginx
version: green
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
volumeMounts:
- mountPath: /usr/share/nginx/html/index.html # mount index.html to /usr/share/nginx/html/index.html
subPath: index.html
readOnly: true
name: index-html
volumes:
- name: index-html
configMap:
name: green-index-html # place ConfigMap `index-html` on /usr/share/nginx/html/index.html
items:
- key: index.html
path: index.html
Loading