Canary Deployment Strategy using Argocd rollout and Service Mesh Interface (Traefik Mesh)

677 Views Asked by At

enter image description here

I'm working on the Canary Deployment Strategy. I use the Service Mesh Interface, after installing trafik mesh. When starting the program for the first time with the command

kubectl apply -f applications.yaml

It should deploy the entire application i.e. 4 replicas, but it deploys only 20% (1 replica) of the application, and it goes into progressing state with an error:

TrafficRoutingErro: the server could not find the requested resource (post trafficsplits.splits.smi-spec.io) TrafficSplitNotCreated: Unable to create traffic Split 'demo-traefficsplit'

Here is my manifest:

argocd-rollout.yaml

---
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: demo
  labels:
    app: demo
spec:
  strategy:
    canary:
      steps:
      - setWeight: 20
      - pause:
          duration: "1m"
      - setWeight: 50
      - pause:
          duration: "2m"
      canaryService: demo-canary
      stableService: demo

      trafficRouting:
        smi:
          rootService: demo-smi
          trafficSplitName: demo-trafficsplit

  replicas: 4
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      app: demo
      version: blue
  template:
    metadata:
      labels:
        app: demo
        version: blue
    spec:
      containers:
      - name: demo
        image: argoproj/rollouts-demo:blue
        imagePullPolicy: Always
        ports:
        - name: web
          containerPort: 8080
        resources:
          requests:
            memory: "64Mi"
            cpu: "100m"
          limits:
            memory: "128Mi"
            cpu: "140m"

---
apiVersion: split.smi-spec.io/v1alpha3
kind: TrafficSplit
metadata:
  name: demo-trafficsplit
spec:
  service: demo-smi # controller uses the stableService if Rollout does not specify the rootService field
  backends:
  - service: demo
    weight: 10
  - service: demo-canary
    weight: 90

---
apiVersion: v1
kind: Service
metadata:
  name: demo-smi
spec:
  ports:
  - port: 80
    targetPort: 8080
  selector:
    app: demo
    version: blue
  type: ClusterIP

---
apiVersion: v1
kind: Service
metadata:
  name: demo
spec:
  ports:
  - port: 80
    targetPort: 8080
  selector:
    app: demo
    version: blue
  type: ClusterIP

---
apiVersion: v1
kind: Service
metadata:
  name: demo-canary
spec:
  ports:
  - port: 80
    targetPort: 8080
  selector:
    app: demo
    version: blue
  type: ClusterIP

---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: rollout-ing
spec:
  entryPoints:
    - websecure
  routes:
    - kind: Rule
      match: Host(`mycompagny.com`) 
      services:
        - name: demo-smi
          port: 80
  tls:
    certResolver: myresolver

applications.yaml

apiVersion: v1
kind: Namespace
metadata:
  name: net

---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: rollout
  namespace: argocd
spec:
  project: default
  source:
    repoURL: [email protected]:telemaqueHQ/DevOps.git
    targetRevision: master
    path: gitOps/test/argocd
  destination:
    server: https://kubernetes.default.svc
    namespace: net
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

0

There are 0 best solutions below