DevOps Training Program that will provide you with in-depth knowledge of various DevOps tools including Git, Jenkins, Docker, Ansible, Puppet, Kubernetes and Nagios. This training is completely hands-on and designed in a way to help you become a certified practitioner through best practices in Continuous Development, Continuous Testing, Configuration Management and Continuous Integration, and finally, Continuous Monitoring of software throughout its development life cycle.
Blue/green deployment is a continuous deployment process that reduces downtime and risk by having two identical production environments, called blue and green.
we will start by creating a Two Deployment Manifests
vi DemoApp001.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy2
labels:
app: app-v1
spec:
replicas: 3
selector:
matchLabels:
app: app-v1
template:
metadata:
labels:
app: app-v1
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: beta.kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- name: deploy-images
image: kellyamaploy-images:v1
ports:
- containerPort: 8080
vi DemoApp002.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy2
labels:
app: app-v2
spec:
replicas: 3
selector:
matchLabels:
app: app-v2
template:
metadata:
labels:
app: app-v2
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: beta.kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- name: deploy-images
image: kellyamaploy-images:v1
ports:
- containerPort: 8080
Now we will apply the 2 Deployment Manifests
$ kubectl apply -f DemoApp001.yml
$ kubectl apply -f DemoApp002.yml
This will create deployments app-v1 and app-v2
Then create the Service Manifest to point to app-v1
vi ServiceApp02.yml
apiVersion: v1
kind: Service
metadata:
name: svc2
labels:
app: app-v1
spec:
ports:
- port: 8080
nodePort: 32600
protocol: TCP
selector:
app: app-v1
type: NodePort
copy the public cluster ip and with the port being expose in the SG(32600) and paste in the browse . You will see the App in Blue bg
Now modify the Service Manifest flip the and change the app-v1 to app-v2 and apply the below
vi ServiceApp02.yml
apiVersion: v1
kind: Service
metadata:
name: svc2
labels:
app: app-v2
spec:
ports:
- port: 8080
nodePort: 32600
protocol: TCP
selector:
app: app-v2
type: NodePort
kubectl apply -f ServiceApp02.yml
Now Go Back to the Browser and refresh your screen. You should see the Green App