Kubernetes (K8s) (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
Imperative (`kubectl create/run`) vs. Declarative (`kubectl apply -f`) Management.
junior LevelMost AskedCode ExamplekubernetesBasic
In Simple Words:
- Imperative Management: You tell Kubernetes what actions to perform step-by-step:
Hard to track in Git, prone to configuration drift, and not reproducible.bash
kubectl run nginx --image=nginx --port=80 kubectl scale deployment web --replicas=5 - Declarative Management (The Kubernetes Way / GitOps):
You write YAML files describing the desired end state and let the Kubernetes reconciliation loop figure out how to achieve it:
Kubernetes compares the desired state in the file with the live state in etcd and applies the minimum required delta.bash
kubectl apply -f deployment.yaml