0
0
Kubernetesdevops~10 mins

Desired state vs actual state reconciliation in Kubernetes - Interactive Practice

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

Complete the code to specify the desired number of replicas in a Kubernetes Deployment manifest.

Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  replicas: [1]
  selector:
    matchLabels:
      app: my-app
Drag options to blanks, or click blank then click option'
A5
B3
C0
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Setting replicas to 0 will stop all pods.
Using a string instead of a number.
2fill in blank
medium

Complete the command to check the actual state of pods in the default namespace.

Kubernetes
kubectl get [1]
Drag options to blanks, or click blank then click option'
Apods
Bservices
Cdeployments
Dnodes
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'services' or 'deployments' shows different resources, not pods.
3fill in blank
hard

Fix the error in the command to apply a manifest file named deployment.yaml.

Kubernetes
kubectl [1] -f deployment.yaml
Drag options to blanks, or click blank then click option'
Aget
Bapply
Cdelete
Ddescribe
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'delete' removes resources instead of applying changes.
Using 'get' or 'describe' only shows info, no changes.
4fill in blank
hard

Fill both blanks to create a label selector that matches pods with label app=web and environment=prod.

Kubernetes
kubectl get pods -l [1]=[2]
Drag options to blanks, or click blank then click option'
Aapp
Bweb
Cenvironment
Dprod
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping key and value positions.
Using incorrect label keys or values.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps pod names to their status phase if the phase is Running.

Kubernetes
pod_status = {pod.metadata.name: pod.status.[1] for pod in pods if pod.status.[2] == '[3]'}
Drag options to blanks, or click blank then click option'
Aphase
CRunning
DReady
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Ready' instead of 'Running' as the phase filter.
Using incorrect attribute names.