Catalog / Kubernetes Cheat Sheet
Kubernetes Cheat Sheet
A handy reference for essential Kubernetes commands, concepts, and configurations, designed to aid developers and operators in managing containerized applications.
Core Concepts
Pods
Definition: The smallest deployable unit in Kubernetes, representing a single instance of a running process.
|
Creating a Pod:
Apply with: |
Common Commands:
|
Deployments
Definition: A Deployment provides declarative updates for Pods and ReplicaSets.
|
Creating a Deployment:
Apply with: |
Common Commands:
|
Services
Definition: An abstraction which defines a logical set of Pods and a policy by which to access them.
|
Creating a Service:
Apply with: |
Common Commands:
|
Namespaces
Definition: Provide a scope for names. Names of resources need to be unique within a namespace, but not across namespaces.
|
Creating a Namespace:
Apply with: |
Common Commands:
|
Configuration and Storage
ConfigMaps
Definition: A ConfigMap is an API object used to store non-confidential data in key-value pairs. Pods can consume ConfigMaps as environment variables, command-line arguments, or as configuration files in a volume.
|
Creating a ConfigMap:
Apply with: |
Common Commands:
|
Secrets
Definition: A Secret is an API object used to store sensitive information, such as passwords, OAuth tokens, and SSH keys.
|
Creating a Secret:
Apply with: Note: Data must be base64 encoded. |
Common Commands:
|
Volumes
Definition: A Volume is a directory, possibly with some data in it, which is accessible to the containers in a pod.
|
Volume Types:
|
Using a Volume:
|
PersistentVolumes and PersistentVolumeClaims
PersistentVolume (PV): A piece of storage in the cluster that has been provisioned by an administrator or dynamically provisioned using Storage Classes. PersistentVolumeClaim (PVC): A request for storage by a user. It is a claim on a PV. |
Creating a PersistentVolume:
|
Creating a PersistentVolumeClaim:
|
Usage: The PVC is then mounted as a volume in a pod. |
Networking
Ingress
Definition: An API object that manages external access to the services in a cluster, typically HTTP.
|
Creating an Ingress:
Note: Requires an Ingress Controller to be running in the cluster. |
Common Commands:
|
Network Policies
Definition: An application-centric view of which connections are allowed. They specify how pods are allowed to communicate with each other and other network endpoints.
|
Creating a Network Policy:
Note: Requires a Network Policy Controller to be running in the cluster. |
Common Commands:
|
DNS
Service Discovery: Kubernetes provides internal DNS resolution so pods can discover services by their DNS name.
|
Example: A service named |
Advanced Topics
Helm
Definition: A package manager for Kubernetes, allowing you to define, install, and upgrade even the most complex Kubernetes application.
|
Common Commands:
|
Operators
Definition: Operators are software extensions to Kubernetes that manage applications and their components.
|
Key Concepts: Operators leverage Kubernetes’ extensibility to define custom resources and controllers that implement application-specific logic. |
Troubleshooting
Common Issues and Commands:
|