Created
January 20, 2021 22:52
-
-
Save dmusicant-dk/262b2ded0e4addd79ac6f4ed4178f1df to your computer and use it in GitHub Desktop.
Kubectl Common Commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See which clusters you have configured to connect to | |
kubectl config get-clusters | |
# Get info on the default cluster | |
kubectl cluster-info | |
# Get detailed info on the default cluster | |
kubectl cluster-info dump | |
# Some debugging commands | |
# Get list of events raised in a specific namespace ("data-layer" in this example) | |
kubectl get events -n data-layer | |
# Get the logs from a pod | |
kubectl logs my-pod-1ac3ex56g32 | |
# Deleting Pods | |
# You don't actually delete pods, you delete deployments as we'll | |
# see below. Or you can edit the deployment to lower the replicas | |
# number which will remove pods. | |
# | |
# There are two ways to do this: | |
# 1. Delete the deployment directly in K8s | |
# 2. Delete using the original YAML | |
# Delete the deployment directly in K8s | |
kubectl delete deployment nginx-depl | |
# Delete using the original YAML | |
kubectl delete -f nginx-deployment.yaml | |
# More here: https://kubernetes.io/docs/reference/kubectl/cheatsheet/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment