0
0
Kubernetesdevops~10 mins

Blue-green deployments in Kubernetes - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a new deployment named 'green' in Kubernetes.

Kubernetes
kubectl create deployment [1] --image=nginx:latest
Drag options to blanks, or click blank then click option'
Ared
Bgreen
Cblue
Dyellow
Attempts:
3 left
💡 Hint
Common Mistakes
Using the old deployment name 'blue' instead of 'green'.
2fill in blank
medium

Complete the code to switch the service to point to the green deployment.

Kubernetes
kubectl patch service my-service -p '{"spec": {"selector": {"app": "[1]"}}}'
Drag options to blanks, or click blank then click option'
Agreen
Bblue
Cred
Dyellow
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving the selector as 'blue' so traffic does not switch.
3fill in blank
hard

Fix the error in the command to delete the old blue deployment.

Kubernetes
kubectl delete deployment [1]
Drag options to blanks, or click blank then click option'
Agreen
Byellow
Cblue
Dred
Attempts:
3 left
💡 Hint
Common Mistakes
Deleting the 'green' deployment instead of 'blue'.
4fill in blank
hard

Fill both blanks to create a service that routes traffic to the blue deployment.

Kubernetes
kubectl expose deployment [1] --port=[2] --target-port=80
Drag options to blanks, or click blank then click option'
Ablue
Bgreen
C8080
D80
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong deployment name or port number.
5fill in blank
hard

Fill all three blanks to create a deployment with label 'app=green' and image 'nginx:stable'.

Kubernetes
kubectl create deployment [1] --image=[2] --dry-run=client -o yaml | kubectl set [3] app=[1] -f - --local -o yaml
Drag options to blanks, or click blank then click option'
Agreen
Bnginx:stable
Clabel
Dblue
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong deployment name or image, or wrong kubectl command for labeling.