-
Pod: A pod is the smallest deployable unit in Kubernetes, encapsulating one or more containers that share storage, network, and specifications. Pods ensure co-located containers work together as a single application.
-
Node: A node is a physical or virtual machine in a Kubernetes cluster. It runs pods and includes essential components like kubelet, kube-proxy, and a container runtime to manage workloads.
-
Service: A service provides a stable network endpoint to expose a set of pods. It enables communication between components or external clients, abstracting dynamic pod IPs with consistent DNS or IP.
-
ConfigMap: A ConfigMap stores non-sensitive configuration data as key-value pairs. It decouples configuration from application code, allowing pods to consume settings dynamically via environment variables, command-line arguments, or mounted volumes.
-
Namespace: A namespace is a logical partition within a Kubernetes cluster. It isolates resources like pods, services, and ConfigMaps, enabling multi-tenancy, resource organization, and access control for different teams or projects.
kubectl get pods
Lists all pods in the current namespace or a specified namespace.
kubectl get nodes
Displays the status and details of all nodes in the cluster.
kubectl describe pod <pod-name>
Provides detailed information about a specific pod, including events and resource usage.
kubectl logs <pod-name>
Fetches the logs of a specific pod to debug or monitor its output.
kubectl exec -it <pod-name> -- /bin/bash
Opens an interactive shell session inside a running pod for troubleshooting.
kubectl apply -f <file.yaml>
Creates or updates resources in the cluster using a YAML configuration file.
kubectl delete -f <file.yaml>
Deletes resources defined in a YAML configuration file from the cluster.
kubectl scale deployment <deployment-name> --replicas=<number>
Adjusts the number of replicas for a deployment to scale up or down.
kubectl rollout status deployment <deployment-name>
Monitors the status of a deployment rollout to ensure it completes successfully.
kubectl get services
Lists all services in the current namespace or a specified namespace.
kubectl port-forward <pod-name> <local-port>:<pod-port>
Forwards a local port to a port on a pod for accessing services locally.
kubectl get configmaps
Lists all ConfigMaps in the current namespace, which store configuration data.
kubectl get secrets
Lists all secrets in the current namespace, which store sensitive data like passwords.
kubectl top pods
Displays resource usage (CPU and memory) of pods in the cluster.
kubectl create namespace <namespace-name>
Creates a new namespace to logically isolate resources within the cluster.