Kubernetes Cheat Sheet

This cheat sheet is a valuable resource for anyone who wants to learn Kubernetes. It is a quick and easy way to learn about the most common Kubernetes commands, objects, and concepts, and it can help you to deploy and manage containerized applications at scale.

Kubernetes is an open-source container orchestration platform that automates containerized applications' deployment, scaling, and management. It provides a robust framework for running containers across clusters of hosts, enabling efficient resource utilization and workload distribution. By referring to a Kubernetes cheat sheet, you can quickly access and understand the essential commands, objects, and concepts related to Kubernetes. This will enable you to deploy applications, manage pods, scale resources, perform rolling updates, and leverage other advanced features Kubernetes offers. Whether you are a developer or a system administrator, a Kubernetes cheat sheet can serve as a valuable reference to navigate and utilize the powerful capabilities of Kubernetes in container management.

Kubernetes Cheat Sheet

This cheat sheet is a valuable resource for anyone who wants to learn Kubernetes. It is a quick and easy way to learn about the most common Kubernetes commands, objects, and concepts, and it can help you to deploy and manage containerized applications at scale.

Kubernetes is an open-source container orchestration platform that automates containerized applications' deployment, scaling, and management. It provides a robust framework for running containers across clusters of hosts, enabling efficient resource utilization and workload distribution. By referring to a Kubernetes cheat sheet, you can quickly access and understand the essential commands, objects, and concepts related to Kubernetes. This will enable you to deploy applications, manage pods, scale resources, perform rolling updates, and leverage other advanced features Kubernetes offers. Whether you are a developer or a system administrator, a Kubernetes cheat sheet can serve as a valuable reference to navigate and utilize the powerful capabilities of Kubernetes in container management.

Kubernetes CLI (kubectl) Commands

  1. Cluster Management:

    • kubectl cluster-info: Display cluster information.

    • kubectl get nodes: List all nodes in the cluster.

    • kubectl describe node node_name: Show detailed information about a specific node.

  2. Pod Management:

    • kubectl get pods: List all pods in the current namespace.

    • kubectl describe pod pod_name: Show detailed information about a specific pod.

    • kubectl logs pod_name: Print the logs of a specific pod.

    • kubectl exec -it pod_name -- container_name command: Execute a command in a running container within a pod.

    • kubectl delete pod pod_name: Delete a specific pod.

  3. Deployment Management:

    • kubectl get deployments: List all deployments in the current namespace.

    • kubectl describe deployment deployment_name: Show detailed information about a specific deployment.

    • kubectl scale deployment deployment_name --replicas=3: Scale the number of replicas for a deployment to 3.

    • kubectl rollout status deployment deployment_name: Check the status of a deployment rollout.

    • kubectl rollout history deployment deployment_name: View the revision history of a deployment.

    • kubectl rollout undo deployment deployment_name: Rollback a deployment to the previous revision.

  4. Service Management:

    • kubectl get services: List all services in the current namespace.

    • kubectl describe service service_name: Show detailed information about a specific service.

    • kubectl expose deployment deployment_name --type=LoadBalancer --port=80: Expose a deployment as a LoadBalancer service on port 80.

    • kubectl delete service service_name: Delete a specific service.

  5. Namespace Management:

    • kubectl get namespaces: List all namespaces in the cluster.

    • kubectl describe namespace namespace_name: Show detailed information about a specific namespace.

    • kubectl create namespace namespace_name: Create a new namespace.

    • kubectl delete namespace namespace_name: Delete a specific namespace.

  6. Configuration Management:

    • kubectl create configmap configmap_name --from-file=path/to/file: Create a ConfigMap from a file.

    • kubectl create secret generic secret_name --from-literal=key=value: Create a Secret from a literal key-value pair.

    • kubectl describe configmap/configmap_name: Show detailed information about a specific ConfigMap.

    • kubectl describe secret/secret_name: Show detailed information about a specific Secret.

    • kubectl get configmaps: List all ConfigMaps in the current namespace.

    • kubectl get secrets: List all Secrets in the current namespace.

  7. Volume Management:

    • kubectl get pv: List all persistent volumes.

    • kubectl get pvc: List all persistent volume claims in the current namespace.

    • kubectl describe pv pv_name: Show detailed information about a specific persistent volume.

    • kubectl describe pvc pvc_name: Show detailed information about a specific persistent volume claim.

  8. Health Checks:

    • kubectl get readiness/liveness probe pod_name: Check the status of readiness or liveness probes for a specific pod.

    • kubectl describe pod pod_name: Show the status of readiness and liveness probes for containers within a pod.

  9. Secrets and ConfigMaps:

    • kubectl create secret generic secret_name --from-file=path/to/file: Create a Secret from a file.

    • kubectl create configmap configmap_name --from-file=path/to/file: Create a ConfigMap from a file.

    • kubectl create secret generic secret_name --from-literal=key=value: Create a Secret from a literal key-value pair.

    • kubectl create configmap configmap_name --from-literal=key=value: Create a ConfigMap from a literal key-value pair.

  10. Advanced Operations:

    • kubectl apply -f filename: Apply a configuration file to create or update resources.

    • kubectl explain resource: Get detailed information about a specific resource.

    • kubectl get events: List events related to resources in the current namespace.

Learn more Kubernetes skills on Coursera.

Kubernetes CoursesOpens in a new tab | DevOps CoursesOpens in a new tab | Docker CoursesOpens in a new tab | Microsoft Azure CoursesOpens in a new tab | Node.Js CoursesOpens in a new tab | Cloud Computing CoursesOpens in a new tab

CommunityJoin a community of over 100 million learners from around the world
CertificateLearn from more than 200 leading universities and industry educators.
Confidence70% of all learners who have stated a career goal and completed a course report outcomes such as gaining confidence, improving work performance, or selecting a new career path.
All courses include:
  • 100% online
  • Flexible schedule
  • Mobile learning
  • Videos and readings from professors at world-renowned universities and industry leaders
  • Practice quizzes

Can’t decide what is right for you?

Try the full learning experience for most courses free for 7 days.

Register to learn with Coursera’s community of 87 million learners around the world