Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.96 KB

kubernetes.md

File metadata and controls

34 lines (26 loc) · 1.96 KB

Kubernetes Cheat Sheet

General

Command Description
kubectl config current-context Check to which Kubernetes cluster we are connected.
kubectl get nodes List all nodes on the Kubernetes cluster.
kubectl run -it --rm --restart=Never <POD-NAME> --image=<IMAGE-NAME> <COMMAND> Installs the given image as a pod in the Kubernetes cluster, connect to it interactively and executes the supplied command.
kubectl exec <POD-NAME> -c <CONTAINER-NAME> -- <COMMAND> Execute the given command on the specified container running in the specified pod.

Resources

Command Description
kubectl create -f <file_location> Creates a new object based on the given file (which should be a Kubernetes manifest file, either YAML or JSON).
kubectl apply -f <file_location> Updates the desired state of the object on the Kubernetes cluster.
`kubectl get [nodes pods
`kubectl describe [nodes pods
`kubectl delete [nodes pods
kubectl expose rc <rc_name> —name=<service_name> --target-port=8080 --type=NodePort Creates a new services with the supplied name that targets pods on port 8080 and listens on a dynamically created port.

Rollout

Command Description
kubectl rollout status deployment <deployment_name> Get the status of the deployment matching the supplied name.
kubectl rollout history deployment <deployment_name> List all revisions of the deployment matching the supplied name.
kubectl rollout undo deployment <deployment_name> —to-revision=<revision_number> Rollback to a specific revision.

Useful links