If we want to do a blue-green style deployment for our component web of the pets application, then we can do so by using labels creatively. First, let's remind ourselves how blue-green deployments work. Here is a rough step-by-step instruction:
- Deploy the first version of the web component as blue. We will label the pods with a label of color: blue to do so.
- Deploy the Kubernetes service for these pods with the color: blue label in the selector section.
- Now, we can deploy version 2 of the web component, but, this time, the pods have a label of color: green.
- We can test the green version of the service to check that it works as expected.
- Now, we flip traffic from blue to green by updating the Kubernetes service for the web component. ...