Skip to content

Latest commit

 

History

History
56 lines (50 loc) · 1.69 KB

cheatsheet.md

File metadata and controls

56 lines (50 loc) · 1.69 KB

KickStart

Create kubernetes object
kubectl create -f <file_name>

List of all objects

kubectl get all

Pods

Get list of pods

kubectl get pods

For wide output

kubectl get pods -o wide

Get detailed description of pod

kubectl get pod <pod_name>

Delete a pod

kubectl delete pod <pod_name>

Replica Controller

Get list of Replication Controllers

kubectl get replicationcontroller
You can use rs instead of replicationcontroller

Get detailed description of Replication Controller

kubectl describe replicationcontroller <replication_controller_name>

Delete a Replication Controller

kubectl delete replicationcontroller <replication_controller_name>

Replica Set

Get list of Replica Set

kubectl get replicaset
You can also use rs instead of replicaset

Get detailed description of Replica Set

kubectl describe replicaset <replica_set_name>

Delete a Replica Set

kubectl delete replicaset

Scaling

Changing from file

kubectl replace -f <file_name>

Scaling without file change

kubectl scale --replicas=<no_of_new_replicas> -f <file_name>
Eg. kubectl scale --replicas=5 -f <file_name>

Scaling using resource name

kubectl scale --replicas=<no_of_new_replicas> <resource_type> <resource_name>
Eg. kubectl scale --replicas=5 replicaset <resource_name>

Deployemnt

Get list of deployments

kubectl get deployments

Get description of deployment

kubectl describe deployments

Delete a deployment

kubectl delete deployment <deployment_name>

Update a deployment

kubectl apply -f <file_name>

Rollout an update to previous version

kubectl rollout undo deployment <deployment_name>