Kubernetes Cheatsheet
Kubernetes
kubectl
Containers
Orchestration
Complete reference for Kubernetes container orchestration covering pods, deployments, services, ingress, storage, networking, and cluster management with kubectl commands.
Quick Reference
🚀 Workloads & Pods
Pod management, deployments, services, and scaling
🔧 Configuration
ConfigMaps, secrets, namespaces, and RBAC
🌐 Networking
Services, ingress, network policies, and DNS
💾 Storage & Monitoring
Persistent volumes, monitoring, and troubleshooting
Getting Started
Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications across clusters of hosts.
Kubernetes Basics
Key concepts
- Cluster - A set of nodes that run containerized applications
- Node - A worker machine in Kubernetes, either physical or virtual
- Pod - The smallest deployable unit that can contain one or more containers
- Service - An abstraction that defines a logical set of pods and access policy
- Deployment - Manages a replicated application on your cluster
Essential kubectl setup
Creating Objects
Kubernetes objects can be created declaratively using YAML files or imperatively using kubectl commands. Declarative approach is recommended for production.
Basic Resource Creation
Creating resources from files
Imperative resource creation
Generate YAML files
Pods
Pods are the smallest deployable units in Kubernetes and represent a group of one or more containers that share storage and network resources.
Pod Management
Basic pod operations
Pod interaction
Temporary pods for debugging
Deployments
Deployments provide declarative updates for pods and ReplicaSets, enabling rolling updates, rollbacks, and scaling operations.
Deployment Management
Basic deployment operations
Scaling and updates
Rollout management
Services
Services provide stable network endpoints for pods, enabling load balancing and service discovery within the cluster.
Service Types and Management
Service operations
Service types
Configuration Management
ConfigMaps and Secrets allow you to decouple configuration from application code, making your applications more portable and secure.
ConfigMaps
ConfigMap operations
Secrets
Secret operations
Namespaces
Namespaces provide a way to divide cluster resources between multiple users, teams, or environments within the same cluster.
Namespace Management
Namespace operations
Working with namespaces
Storage
Kubernetes provides persistent storage through Persistent Volumes (PV) and Persistent Volume Claims (PVC) for stateful applications.
Persistent Volumes
PV operations
PVC operations
Workload Controllers
Kubernetes provides various workload controllers for different use cases: DaemonSets for node-level services, StatefulSets for stateful applications, and Jobs for batch processing.
DaemonSets
DaemonSet operations
StatefulSets
StatefulSet operations
Jobs and CronJobs
Job operations
CronJob operations
Networking
Kubernetes networking includes Ingress controllers for external access, Network Policies for security, and service mesh integration for advanced traffic management.
Ingress
Ingress operations
Network Policies
Network Policy operations
Node Management
Node management includes monitoring node health, cordoning nodes for maintenance, and draining nodes safely before updates.
Node Operations
Node management
Monitoring and Troubleshooting
Kubernetes provides various tools for monitoring cluster health, resource usage, and troubleshooting application issues.
Resource Monitoring
Resource usage
Cluster information
Labels and Selectors
Labels are key-value pairs attached to objects for identification and selection. Selectors are used to filter objects based on labels.
Label Operations
Working with labels
Security and RBAC
Role-Based Access Control (RBAC) provides fine-grained access control to Kubernetes resources based on user roles and permissions.
RBAC Operations
Permission checking
Service Accounts
Roles and Bindings
Best Practices
Follow these Kubernetes best practices for secure, efficient, and maintainable cluster operations.
- Use namespaces to organize and isolate resources in multi-tenant environments
- Apply resource limits and requests to prevent resource starvation
- Use liveness and readiness probes for application health monitoring
- Implement RBAC for proper access control and security
- Use ConfigMaps and Secrets for configuration management
- Label resources consistently for better organization and automation
- Use Deployments over Pods for better management and rolling updates
- Monitor resource usage with kubectl top and proper monitoring tools
- Use ingress controllers for external traffic management
- Implement network policies for network segmentation and security
- Regular cluster maintenance including node updates and certificate rotation
- Use helm charts for complex application deployment and management
Learn More
Explore comprehensive Kubernetes documentation and container orchestration best practices
Written by
Deepak Jangra
Created At
Wed Jan 15 2025
Updated At
Fri Jun 13 2025