Skip to content

Instantly share code, notes, and snippets.

@dmusicant-dk
Created January 20, 2021 22:52
Show Gist options
  • Save dmusicant-dk/262b2ded0e4addd79ac6f4ed4178f1df to your computer and use it in GitHub Desktop.
Save dmusicant-dk/262b2ded0e4addd79ac6f4ed4178f1df to your computer and use it in GitHub Desktop.
Kubectl Common Commands
# 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