Show Menu

Kubernetes Cheat Sheet by

kubectl     kubernetes


Group of containers that are deployed together on the same host
Abstra­ction which defines a logical set of pods and a policy by which to access them
Worker machine in the cluster
Public config­uration data in the form of a key-value pair
Private config­uration data
Creates pod(s) and ensures that a specified number succes­sfully terminate
Time-based job
API object that manages external access to the services in a cluster, typically HTTP.
Desired state of pods for declar­ative updates
Specif­ication that requires a particular pod to be run on some or all nodes
Requir­ement that a specified number of pods are running at any given time
Persistent storage in the cluster with an indepe­ndent lifecycle
Request for storage (for a Persi­ste­ntV­olume) by a user

Cluster Management

kubectl proxy
Proxy the api server API to your local machine on port 8001
kubectl port-f­orward {pod_name} {local­_port}: {remot­e_p­ort}
Forward the pod port to your local port
kubectl scale --repl­icas=3 {resou­rce­_ty­pe}­/{r­eso­urc­e_name }
Scale given resource

Viewing Objects

kubectl get --all-­nam­espaces {objec­t_t­ype}
Get objects from all namespaces
kubectl describe {objec­t_t­ype}
Describes the given objects
kubectl get services --sort­-by­=.m­eta­dat­
List services sorted by name
kubectl get pods --fiel­d-s­ele­cto­r=s­tat­us.p­ha­se=­Run­ning
Get list of running pods
kubectl get events
Show events

Modifying Objects

kubectl apply -f ./myma­nif­est.yaml
Apply a config­uration to a object by filename or stdin. Also overrides the existing config­ura­tion.
kubectl create -f ./myma­nif­est.yaml
Create object(s)
kubectl create -f ./dir
Create object(s) in all manifest files in dir
kubectl create -f https:­//g­it.i­o/vPi eo
Create from url
kubectl run nginx --imag­e=n­ginx
Start a single instance of nginx
kubectl replace -- force -f ./pod.j­son
Force replace, delete and then re-create the resource. Will cause a service outage.
kubectl edit svc/do­cke­rre­gistry
Edit the service named docker­-re­gistry

Download the Kubernetes Cheat Sheet

1 Page

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!



No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Kubectl Cheat Sheet