video solution
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
labels:
app: meg-app2
name: meg-app2
namespace: meg
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: meg-app2
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: meg-app2
spec:
containers:
- env:
- name: SERVER_NAME
value: megApp2
- name: SRV_PORT
value: "80"
image: viktoruj/ping_pong:alpine
imagePullPolicy: IfNotPresent
name: app
ports:
- containerPort: 80
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
apiVersion: v1
kind: Service
metadata:
annotations:
labels:
app: meg-service2
name: meg-service2
namespace: meg
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: meg-app2
type: ClusterIP
# 3_ing.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: meg-app2
namespace: meg
annotations:
nginx.ingress.kubernetes.io/canary: "true"
nginx.ingress.kubernetes.io/canary-weight: "30"
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /app
pathType: Prefix
backend:
service:
name: meg-service2
port:
number: 80