Context
A context in kubeconfig conists of a cluster, a user, and a namespace. The current context is the cluster that is currently the default for kubectl, and is the default context used by kubectl commands.
cluster- The cluster where the API server is runninguser- The user account that you want to use to interact with the clusternamespace- The default namespace to use for CLI operations without specifying a namespace
View current context
kubectl config view
kubectl config get-contexts- List all the contextskubectl config use-context <context-name>- Switch to a different contextkubectl config set-context <context-name> --namespace=<namespace-name>- Set the namespace for the current context
or you can edit the kubeconfig file directly like a sane person
Objects
-
kubectl get all- List all objects in the current namespace -
kubectl get <object-type>- List all objects of a type -
kubctl get <object-type> <object-name>- Get a specific object -
kubectl describe <object-type> <object-name>- Get detailed information about a specific object -
kubectl delete <object-type> <object-name>- Delete a specific object
object types:
podsservicesreplicasetsdeploymentsnodesingresssecretsconfigmapsnamespaces
etc…