Skip to main content

If you’re like me, you may have those moments where you’re at the terminal, hands hovering over your keyboard, and … nothing. I always seem to freeze up and probably rely too much on bash history. (The up arrow is my friend.)

While learning Kubernetes, I ended up posting 14 or 15 sticky notes on my monitor to help me in those moments — but after a while, I could barely read what was on the screen. So finally, I created one small, easy-to-read piece of paper to reference when I, or you, get stuck. This Kubernetes Cheat Sheet is meant to get you started performing commands in Kubernetes and provide you with all the basic commands at a quick glance. (Check out the downloadable asset below!)

Command Results

Some of the commands on this cheat sheet might not return any results, but have no fear! See below for some resources you can create, then quickly turn around and run the commands in your cheat sheet to alter your resources any way you wish!

Let’s start with pods. Here is the YAML for a basic busybox pod:

apiVersion: v1
kind: Pod
name: busybox
- image: busybox:1.28.4
- sleep
- "3600"
name: busybox
restartPolicy: Always

Learn more about YAML here.

Create the pod with this command:

kubectl create -f busybox.yaml

Use this command to create a deployment:

kubectl run nginx --image=nginx

Use this command to create a service from the deployment above:

kubectl expose deployment nginx --port=80 --type=NodePort

Sign up for a free community account today and check out these free courses: Kubernetes Essentials and Beginner’s Guide to Containers and Orchestration to learn more about Kubernetes!

Here is the YAML for a simple persistent volume using local storage from the node:

apiVersion: v1
kind: PersistentVolume
name: data-pv
namespace: web
storageClassName: local-storage
storage: 1Gi
- ReadWriteOnce
path: /mnt/data

Use the following command to create the persistent volume:

kubectl apply -f my-pv.yaml

Here is the YAML for a simple ConfigMap:

apiVersion: v1
kind: ConfigMap
name: my-config-map
myKey: myValue
anotherKey: anotherValue

Use the following command to create the ConfigMap:

kubectl apply -f configmap.yaml

Here is the YAML for a secret:

apiVersion: v1
kind: Secret
name: my-secret
myKey: myPassword

Use this command to create the secret:

kubectl apply -f secret.yaml

Here is the YAML for a service account:

apiVersion: v1
kind: ServiceAccount
name: acr
namespace: default
- name: acr

Use this command to create the service account:

kubectl apply -f serviceaccount.yaml

Download Now!

This should be enough to get you started! I’ve also created this PDF for you to download and keep next to you for reference!

Kubernetes Cheat Sheet


If you enjoyed these exercises and following along with the commands, check out the brand new Cloud Native Certified Kubernetes Administrator (CKA) course on Linux Academy to dig deeper into Kubernetes! Or check out these additional free resources:


Image of skye
1 year ago

Attempting to download PDF : 404 not found

Image of Christophe Limpalair
Christophe Limpalair
1 year ago

Sorry about that, here’s the updated link:

Image of milano fili
milano fili
1 year ago

Can’t download the pdf

Image of Christophe Limpalair
Christophe Limpalair
1 year ago

Sorry about that. Here’s the updated link:

Image of Rakesh Singh
Rakesh Singh
5 months ago

Thanks for taking the time to create this useful cheat sheet.

I have an annoying habit of typing ‘git’ instead of ‘docker’ – especially when doing a pull/push.
And I cannot count the number of times I’ve typed ‘docker’ instead of ‘kubectl’
I think I need to create a little ncurses menu system based on these commands 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *