Complete the code to define a Custom Resource Definition (CRD) with the correct API version.
apiVersion: [1]
kind: CustomResourceDefinition
metadata:
name: widgets.example.comThe correct API version for defining a CustomResourceDefinition is apiextensions.k8s.io/v1.
Complete the code to specify the kind of the custom resource in the CRD spec.
spec:
group: example.com
versions:
- name: v1
served: true
storage: true
scope: Namespaced
names:
plural: widgets
singular: widget
kind: [1]The kind field should be the singular, PascalCase name of the custom resource, here Widget.
Fix the error in the command to create a custom resource from a YAML file named 'widget.yaml'.
kubectl [1] -f widget.yamlTo create a custom resource from a YAML file, the correct command is kubectl create -f widget.yaml.
Fill both blanks to define a Custom Resource Definition with the correct scope and plural name.
spec: scope: [1] names: plural: [2]
The scope should be Namespaced for resources limited to namespaces, and the plural name should be the plural form, here widgets.
Fill all three blanks to create a dictionary comprehension that filters custom resources with replicas greater than 3.
filtered = {cr['metadata']['name']: cr['spec']['replicas'] for cr in resources if cr['spec']['replicas'] [1] [2]The comprehension filters resources where replicas is greater than 3, so the operator is > and the number is 3.