Created
January 28, 2025 18:59
-
-
Save ehrnst/211a7cc02285830d255cc48af3ebf1a2 to your computer and use it in GitHub Desktop.
Kubernetes canary deployments with NGINX. No Flagger or Argo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: echo-canary | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: echo | |
version: canary | |
template: | |
metadata: | |
labels: | |
app: echo | |
version: canary | |
spec: | |
containers: | |
- name: echo-container | |
image: hashicorp/http-echo:latest | |
args: | |
- -listen=:80 | |
- --text="Hello, Canary" | |
ports: | |
- containerPort: 80 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: echo-canary-service | |
spec: | |
selector: | |
app: echo | |
version: canary | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 80 | |
type: ClusterIP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: echo | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: echo | |
template: | |
metadata: | |
labels: | |
app: echo | |
spec: | |
containers: | |
- name: echo-container | |
image: hashicorp/http-echo:latest | |
args: | |
- -listen=:80 | |
- --text="Hello, World" | |
ports: | |
- containerPort: 80 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: echo-service | |
spec: | |
selector: | |
app: echo | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 80 | |
type: ClusterIP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
name: echo-ingress | |
spec: | |
rules: | |
- host: echo.example.com | |
http: | |
paths: | |
- path: / | |
pathType: Prefix | |
backend: | |
service: | |
name: echo-service | |
port: | |
number: 80 | |
--- | |
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
name: echo-canary-ingress | |
annotations: | |
nginx.ingress.kubernetes.io/canary: "true" | |
nginx.ingress.kubernetes.io/canary-weight: "20" # percentage of traffic. You can also chose to run other stragies like cookie based, header based etc. | |
spec: | |
rules: | |
- host: echo.example.com | |
http: | |
paths: | |
- path: / | |
pathType: Prefix | |
backend: | |
service: | |
name: echo-canary-service | |
port: | |
number: 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment