kubectl config view Show content of file config ($HOME/.kube/config)
kubectl cluster-info Show info of current cluster: kubernetes contorl plane, kubeDNS, kubeDNSUpstream
kubectl cluster-info dump Show all info of current cluster
kubectl get namespaces Reports all namespaces in cluster
kubectl config get-contexts Reports all contexts: name of context, cluster, authinfo and namespace. Mark for current of list.
kubectl config set-context --current --namespace=[namespace name] Switch namespace in current context
kubectl config current-context Reports the current cluster in use
kubectl config use-context [context name] Switch from context to use
kubectl get pods Reports list of pods in namespace of cluster
kubectl exec -it --namespace=[namespace name] [pod name] -- [shell]
Ex.: kubectl exec -it --namespace=clients manager-dshdtr4 -- /bin/sh
To access a pod by ssh
kubectl config view -o jsonpath='{.users[*].name}' | xargs -n1 List users in config files
kubectl config get-clusters Reports list of clusters in config
kubectl config unset users.[user name] Remove user
kubectl config unset contexts.[context name] Remove context
kubectl config unset clusters.[cluster name] Remove cluster
kubectl config delete-cluster [cluster name] Remove cluster
kubectl config delete-context [context name] Remove conxtext
kubectl describe pod [pod name] Describe pod
kubectl config use-context kubecluster2 Switch from cluster to use
kubectl get replicasets Reports replicasets
kubectl delete pod [pod_name] -n [namespace] Delete pod
kubectl delete replicaset [replicaset_name] -n [namespace] Delete replicaset and its pods managed
kubectl get deployments Show deployments files