alias k=kubectl
source <(kubectl completion bash | sed 's/kubectl/k/g')
References
Explain components
kubectl explain pods
Run kubectl from inside a container
TTY connect to your container and make sure kubectl is installed.
Import your Kubernetes config
When you are connected to a container deployed in Kubernetes cluster, it already has access to Kubernetes config and certificates, you only need to import them:
Do not replace any path or URL, you can use exactly the command above.
At this point you should have the file ~/.kube/config.
cat ~/.kube/config
WORKAROUND: if, by any change, you are having a hard time, you can get the /root/.kube/config file from your original installation and restore it inside your container.
If by any reason you could not use kubectl exec (for example, if your container does not allow root auth), then SSH to your K8s worker node which is hosting your pod.
Locate the container you want to connect to:
docker ps |grep "halyard"
Replace halyard with any keyword you want.
Then connect to it:
docker exec -it --user root 261d763bf353 bash
Force delete pod
Never force pod deletion unless it is really necessary
If you have a pod which is referenced by a Replica Set that does not exist and you are stuck, force pod deletion.
kubectl -n PUT-YOUR-NAMESPACE-HERE \
delete pod PUT-YOUR-POD-NAME-HERE \
--grace-period=0 --force