0
0
Kubernetesdevops~10 mins

Custom resources concept 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 define a Custom Resource Definition (CRD) with the correct API version.

Kubernetes
apiVersion: [1]
kind: CustomResourceDefinition
metadata:
  name: widgets.example.com
Drag options to blanks, or click blank then click option'
Acore/v1
Bv1
Capps/v1
Dapiextensions.k8s.io/v1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'v1' or 'core/v1' which are for core Kubernetes resources.
Using 'apps/v1' which is for deployments and similar resources.
2fill in blank
medium

Complete the code to specify the kind of the custom resource in the CRD spec.

Kubernetes
spec:
  group: example.com
  versions:
  - name: v1
    served: true
    storage: true
  scope: Namespaced
  names:
    plural: widgets
    singular: widget
    kind: [1]
Drag options to blanks, or click blank then click option'
AWidget
Bwidgets
CWidgetList
Dwidget
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural or lowercase names for the kind.
Confusing kind with plural or singular names.
3fill in blank
hard

Fix the error in the command to create a custom resource from a YAML file named 'widget.yaml'.

Kubernetes
kubectl [1] -f widget.yaml
Drag options to blanks, or click blank then click option'
Aapply
Brun
Ccreate
Ddelete
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' which is for running pods or containers.
Using 'delete' which removes resources.
Using 'apply' which can update existing resources but may not be ideal for initial creation.
4fill in blank
hard

Fill both blanks to define a Custom Resource Definition with the correct scope and plural name.

Kubernetes
spec:
  scope: [1]
  names:
    plural: [2]
Drag options to blanks, or click blank then click option'
ANamespaced
BCluster
Cwidgets
Dwidget
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular for plural name.
Confusing 'Cluster' and 'Namespaced' scope.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that filters custom resources with replicas greater than 3.

Kubernetes
filtered = {cr['metadata']['name']: cr['spec']['replicas'] for cr in resources if cr['spec']['replicas'] [1] [2]
Drag options to blanks, or click blank then click option'
A>
B3
C==
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using equality or less than operators.
Using the wrong number for comparison.