CKA YAML Configuration 1 — Questions and Answers
Question 1: What format are Kubernetes manifest files typically written in?
- YAML (Correct answer)
- XML
- CSV
- HTML
Correct answer: YAML
Kubernetes uses YAML (YAML Ain't Markup Language) for manifest files that define resources like Pods, Services, and Deployments.
Question 2: What are the four required fields in a Kubernetes manifest?
- apiVersion, kind, metadata, spec (Correct answer)
- name, type, data, config
- version, resource, labels, ports
- image, container, volume, network
Correct answer: apiVersion, kind, metadata, spec
Every Kubernetes manifest requires apiVersion (API group), kind (resource type), metadata (name and labels), and spec (desired state).
Question 3: What does 'kubectl apply -f' do?
- Creates or updates resources defined in a file (Correct answer)
- Deletes resources
- Lists all resources
- Describes a resource
Correct answer: Creates or updates resources defined in a file
kubectl apply -f applies the configuration from a YAML file, creating the resource if it doesn't exist or updating it if it does.
Question 4: What is a Kubernetes label?
- A key-value pair attached to resources for identification and selection (Correct answer)
- A type of container
- A network policy
- A storage class
Correct answer: A key-value pair attached to resources for identification and selection
Labels are key-value pairs attached to Kubernetes objects that can be used to organize, select, and filter resources.
Question 5: What is a Kubernetes namespace?
- A virtual cluster partition for organizing resources (Correct answer)
- A physical server
- A container image
- A network subnet
Correct answer: A virtual cluster partition for organizing resources
Namespaces provide virtual cluster partitioning, allowing teams or projects to share a cluster while isolating their resources.
Question 6: What is the purpose of resource limits in a Pod spec?
- To cap the maximum CPU and memory a container can use (Correct answer)
- To limit the number of Pods
- To restrict network access
- To set disk quotas
Correct answer: To cap the maximum CPU and memory a container can use
Resource limits define the maximum amount of CPU and memory a container can consume, preventing any single container from monopolizing cluster resources.
What format are Kubernetes manifest files typically written in?