Creating the blue deployment

There are many traditional workloads that won't work with Kubernetes' way of rolling updates. If your workload needs to deploy a new version and cut over to it immediately, then you may need to perform blue/green deployment instead. Using the blue/green deployment approach, we will label the current production blue. In the next recipe, we will create an identical production environment called green before redirecting the services to green. 

Let's perform the following steps to create the first application, which we will call blue:

  1. Change directory to where the examples for this recipe are located:
$ cd /src/chapter7/bluegreen
  1. Review the content of the blue-percona.yaml file and use that to create the blue version of your application:
$ kubectl create -f blue-percona.yaml
pod "blue" created
persistentvolumeclaim "demo-vol1-claim" created
  1. Review the content of the percona-svc.yaml  file and use that to create the service. You will see that selector in the service is set to app: blue. This service will forward all the MySQL traffic to the blue pod:
$ kubectl create -f percona-svc.yaml
  1. Get the service IP for perconaIn our example, the Cluster IP is 10.3.0.75:
$ kubectl get svc percona
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
percona ClusterIP 10.3.0.75 <none> 3306/TCP 1m
  1. Edit the sql-loadgen.yaml file and replace the target IP address with your percona service IP. In our example, it is 10.3.0.75:
      containers:
- name: sql-loadgen
image: openebs/tests-mysql-client
command: ["/bin/bash"]
args: ["-c", "timelimit -t 300 sh MySQLLoadGenerate.sh 10.3.0.75 > /dev/null 2>&1; exit 0"]
tty: true

  1. Start the load generator by running the sql-loadgen.yaml job:
$ kubectl create -f sql-loadgen.yaml

This job will generate a MySQL load targeting the IP of the service that was forwarded to the Percona workload (currently blue).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.236.70