Please enable JavaScript.
Coggle requires JavaScript to display documents.
4.4.1 Kubernetes Objects (Enterprise Level) - Coggle Diagram
4.4.1 Kubernetes Objects (Enterprise Level)
What is Kubernetes
Kubernetes is an open-source Container Orchestration Platform.
Container Orchestration means automatically deploying, managing, scaling, networking, updating, monitoring, and recovering containerized applications.
Kubernetes manages the desired state of applications instead of manually managing containers.
What is a Kubernetes Object
Definition
A Kubernetes Object is a persistent record stored inside the Kubernetes cluster.
Every resource in Kubernetes is represented as an object.
Examples
Pod
Deployment
ReplicaSet
StatefulSet
DaemonSet
Service
ConfigMap
Secret
Namespace
PersistentVolume
PersistentVolumeClaim
Job
CronJob
Ingress
NetworkPolicy
ServiceAccount
Purpose
Describe what should exist.
Kubernetes continuously works to make the real state match the desired state.
Desired State Concept
Definition
Desired State is the configuration the administrator wants.
Actual State
Current running condition of the cluster.
Example
Desired
Three nginx Pods
Actual
Only two Pods running
Kubernetes Action
Automatically creates one more Pod.
Enterprise Importance
Self-healing
Auto recovery
Automatic reconciliation
Kubernetes Object Lifecycle
User creates YAML
kubectl sends request
API Server validates request
API Server stores object inside etcd
Scheduler selects worker node
Kubelet creates containers
Status updated
Controller continuously checks object
If object changes
Controller reconciles desired state
Kubernetes API Server
Definition
Central management component of Kubernetes.
Responsibilities
Authentication
Authorization
Validation
Admission Controllers
API endpoint
Stores data into etcd
Communicates with Controllers
Default Port
6443
Linux Location
/etc/kubernetes/manifests/kube-apiserver.yaml
Check
kubectl cluster-info
etcd
Definition
Distributed Key Value Database.
Stores
Cluster State
Objects
Secrets
ConfigMaps
Deployments
Services
Nodes
Namespaces
Enterprise Importance
Source of Truth
Backup Required
High Availability
Manifest
/etc/kubernetes/manifests/etcd.yaml
Backup Command
etcdctl snapshot save backup.db
Anatomy of Kubernetes Object
apiVersion
Kubernetes API version.
Example
apps/v1
v1
batch/v1
kind
Type of object.
Examples
Pod
Deployment
Service
metadata
Purpose
Identity of object.
Contains
name
Unique object name
namespace
Logical isolation
labels
Key value selector
annotations
Extra information
uid
Permanent unique identifier
resourceVersion
Version tracking
creationTimestamp
Creation time
spec
Definition
Desired configuration.
Examples
Number of replicas
Container image
Ports
Volumes
CPU
Memory
Restart policy
status
Definition
Current running information.
Updated by Kubernetes.
Contains
Running
Pending
Failed
Ready
Pod IP
Conditions
Metadata
Definition
Information describing the object.
Contains
Name
Namespace
Labels
UID
ResourceVersion
View
kubectl get pod nginx -o yaml
Labels
Definition
Small key value pairs.
Example
app=nginx
env=production
team=devops
Purpose
Group objects
Filtering
Service selection
Monitoring
Enterprise Examples
environment=production
application=payment
team=security
region=saudi
Label Selectors
Definition
Find matching objects.
Example
kubectl get pods -l app=nginx
Used By
Services
Deployments
ReplicaSets
Annotations
Definition
Additional metadata.
Difference
Labels
Used for selection
Annotations
Not used for selection
Examples
Build information
Git commit
Documentation
Owner
Namespace
Definition
Virtual cluster inside one Kubernetes cluster.
Default Namespaces
default
kube-system
kube-public
kube-node-lease
Enterprise Namespaces
production
development
testing
monitoring
logging
Commands
kubectl get namespaces
kubectl create namespace production
kubectl delete namespace testing
UID
Definition
Permanent object identifier.
Never changes.
Resource Version
Definition
Internal version number.
Used for
Concurrency control
Updates
Watches
Owner References
Definition
Relationship between parent and child objects.
Example
Deployment
ReplicaSet
Pod
If Deployment deleted
ReplicaSet deleted
Pods deleted
Finalizers
Definition
Prevent object deletion until cleanup finishes.
Enterprise Example
Cloud Load Balancer cleanup
Storage cleanup
Declarative Management
Definition
Administrator writes YAML.
Command
kubectl apply -f deployment.yaml
Enterprise Standard
Imperative Management
Definition
Administrator creates object directly from command line.
Example
kubectl create deployment nginx --image=nginx
Good For
Testing
Labs
YAML Manifest
Structure
apiVersion
kind
metadata
name
namespace
labels
annotations
spec
status
Automatically created
Object Storage
User YAML
Git Repository
API Server
etcd Database
Scheduler
Worker Node
Pod Running
Linux Directories
Kubernetes Configuration
/etc/kubernetes/
Static Pods
/etc/kubernetes/manifests/
kubeconfig
/etc/kubernetes/admin.conf
Kubelet Configuration
/var/lib/kubelet/
Container Runtime
/var/lib/containerd/
Logs
journalctl -u kubelet
Enterprise kubectl Commands
Cluster
kubectl cluster-info
API Resources
kubectl api-resources
API Versions
kubectl api-versions
Get Objects
kubectl get pods
kubectl get deployments
kubectl get services
kubectl get namespaces
kubectl get all
Detailed Information
kubectl describe pod nginx
kubectl describe deployment nginx
YAML Output
kubectl get deployment nginx -o yaml
JSON Output
kubectl get deployment nginx -o json
Explain Resource
kubectl explain deployment
kubectl explain deployment.spec
kubectl explain deployment.spec.template.spec
Apply Configuration
kubectl apply -f deployment.yaml
Delete Object
kubectl delete pod nginx
kubectl delete -f deployment.yaml
Edit Live Object
kubectl edit deployment nginx
View Events
kubectl get events
Watch Changes
kubectl get pods --watch
Enterprise Best Practices
Use declarative YAML.
Store YAML files in Git.
Use namespaces for environment separation.
Apply meaningful labels.
Never edit production objects manually unless required.
Use Role-Based Access Control (RBAC).
Back up etcd regularly.
Use version control for manifests.
Follow Infrastructure as Code practices.
Monitor object status continuously.
Common Troubleshooting
Object not created
Check YAML syntax
kubectl apply --dry-run=client
Pod Pending
kubectl describe pod
Image Pull Error
kubectl describe pod
CrashLoopBackOff
kubectl logs pod-name
API Server Down
systemctl status kubelet
journalctl -u kubelet
Object Missing
kubectl get all --all-namespaces
Enterprise Interview Questions
What is a Kubernetes Object
What is Desired State
Difference between Spec and Status
Difference between Labels and Annotations
Difference between Declarative and Imperative management
Why is etcd called the Source of Truth
What is ResourceVersion
What is UID
What is OwnerReference
What is a Finalizer
Explain the lifecycle of a Kubernetes Object.
Where are Kubernetes control plane manifest files stored in Linux
Which component stores Kubernetes Objects
Which component updates object status
Which component continuously reconciles desired state