Bird
0
0

Given this Ingress snippet for A/B testing, what percentage of traffic goes to the canary service?

medium📝 Command Output Q13 of 15
Kubernetes - Advanced Deployment Patterns
Given this Ingress snippet for A/B testing, what percentage of traffic goes to the canary service?
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    nginx.ingress.kubernetes.io/canary: "true"
    nginx.ingress.kubernetes.io/canary-weight: "30"
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: stable-service
            port:
              number: 80
      - path: /
        pathType: Prefix
        backend:
          service:
            name: canary-service
            port:
              number: 80
A70%
B30%
C50%
D100%
Step-by-Step Solution
Solution:
  1. Step 1: Read the canary-weight annotation

    The annotation 'nginx.ingress.kubernetes.io/canary-weight' is set to "30", meaning 30% of traffic goes to canary.
  2. Step 2: Understand traffic split logic

    Traffic is split by percentage; 30% to canary-service, remaining 70% to stable-service.
  3. Final Answer:

    30% -> Option B
  4. Quick Check:

    Canary weight = 30% traffic [OK]
Quick Trick: Check canary-weight value for traffic percent [OK]
Common Mistakes:
  • Assuming canary gets 70% instead of 30%
  • Confusing service names with traffic percentages
  • Ignoring canary annotation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes