0
0
Kubernetesdevops~10 mins

Deployment as higher-level abstraction 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 specify the kind of Kubernetes object for a Deployment.

Kubernetes
apiVersion: apps/v1
kind: [1]
metadata:
  name: nginx-deployment
Drag options to blanks, or click blank then click option'
ADeployment
BConfigMap
CPod
DService
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Pod' instead of 'Deployment' causes only one pod to be created.
Using 'Service' does not manage pod replicas.
2fill in blank
medium

Complete the code to set the number of pod replicas in a Deployment.

Kubernetes
spec:
  replicas: [1]
Drag options to blanks, or click blank then click option'
A"three"
B3
Creplicas
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the number in quotes makes it a string, which is invalid.
Using a boolean like 'true' is incorrect here.
3fill in blank
hard

Fix the error in the selector field to correctly match pod labels.

Kubernetes
spec:
  selector:
    matchLabels:
      app: [1]
Drag options to blanks, or click blank then click option'
Anginx
Bapp
CmatchLabels
Dspec
Attempts:
3 left
💡 Hint
Common Mistakes
Using the label key instead of the value causes no pods to be selected.
Using unrelated words breaks the selector.
4fill in blank
hard

Fill both blanks to complete the pod template labels and container image.

Kubernetes
spec:
  template:
    metadata:
      labels:
        app: [1]
    spec:
      containers:
      - name: nginx
        image: [2]
Drag options to blanks, or click blank then click option'
Anginx
Bnginx:latest
Cnginx:1.21
Dapp
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatching labels and selectors causes pods not to be managed.
Using 'nginx:latest' can cause unpredictable updates.
5fill in blank
hard

Fill all three blanks to complete the Deployment spec with replicas, selector, and container image.

Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
  name: webapp
spec:
  replicas: [1]
  selector:
    matchLabels:
      app: [2]
  template:
    metadata:
      labels:
        app: [2]
    spec:
      containers:
      - name: webapp
        image: [3]
Drag options to blanks, or click blank then click option'
A2
Bwebapp
Cwebapp:v2
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using different labels in selector and template breaks pod matching.
Not specifying replicas as a number causes errors.
Using image without a tag can lead to unexpected versions.