Hello @Harry Whitehouse
Your approach is mostly correct, but there are a few additional steps and considerations to ensure that your new pod will share in the processing as intended.
First, let's address your deployment script. The deployment YAML file you provided is correctly set up to deploy a single canary pod. However, to achieve the desired traffic distribution (1 out of every 4 requests to the canary pod), you will need to configure a load balancer or an ingress controller that supports traffic splitting.
Here are some key points to consider:
Service Configuration: Ensure that your service is correctly configured to route traffic to both the stable and canary pods. You might need to update your service definition to include both sets of pods.
Traffic Splitting: To achieve the 1:4 traffic split, you can use an ingress controller like NGINX or Istio, which supports traffic splitting. You will need to define an ingress rule that specifies the traffic distribution between the stable and canary pods.
Label Selector: Ensure that your service selector matches the labels of both the stable and canary pods. This will allow the service to route traffic to both sets of pods.
Monitoring and Rollback: Monitor the performance and behavior of the canary pod closely. If any issues arise, be prepared to roll back to the stable version.
Here's an example of how you might configure an ingress rule for traffic splitting using NGINX:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: avmscpp-ingress
spec:
rules:
- host: avmscpp.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: avmscpp-service
port:
number: 8356
- host: avmscpp-canary.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: avmscpp-canary-service
port:
number: 8356
In this example, traffic is split between the stable and canary services based on the host header. You can adjust the configuration to achieve the desired traffic distribution.
For more detailed guidance on canary deployments in Kubernetes, you can refer to the Azure Pipelines tutorial on canary deployments
If you have any further questions or need additional assistance, feel free to ask!
If I have answered your question, please accept this as answer as a token of appreciation and don't forget to thumbs up for "Was it helpful"!