Kubernetes Cheatsheet
Kubernetes Cheatsheet
Use the following syntax to run kubectl commands from your terminal window:
i $ kubectl version:
Display the Kubernetes version running on the client and server
01 Cheatsheet
iv $ kubectl config set-cluster <cluster-name>:
Set a cluster entry in the kubeconfig
Create Objects:
YAML or JSON can be used to define Kubernetes manifests. You
can use the `.yaml`,`.yml`, and `.json` file extensions.
02 Cheatsheet
ii $ kubectl <resource-type> <resource-name>:
List a particular resource type
Update Resource:
You may manage your application deployment using a number
of capabilities provided by Kubernetes, including scaling and
upgrading.
03 Cheatsheet
iii $ kubectl rollout undo deployment/frontend
--to-revision=2:
Rollback to a specific revision
04 Cheatsheet
Scale Resources:
A Kubernetes cluster is updated by adding or deleting nodes,
which is known as scaling.
Delete Resources:
The simplest method of deleting any resource in Kubernetes is
to use the specific manifest file used to create it.
05 Cheatsheet
Interacting with Resources:
When interacting with resources in Kubernetes, one may
manage and orchestrate containerized applications effectively
by using declarative YAML manifests to specify desired states
and the Kubernetes API to add, change, or remove resources.
06 Cheatsheet
vii $ kubectl cordon my-node:
Mark my-node as unschedulable
xi $ kubectl cluster-info:
Display addresses of the master and services
Resource Type:
List of resource types that are supported, along with their short-
names, API group, namespacing status, and kind:
i $ kubectl api-resources
Formatting output:
The -o (or --output) parameter should be added to a supported
kubectl command in order to output details in a particular
format to your terminal window.
07 Cheatsheet
Output format Description
08 Cheatsheet