There are times where it is necessary to access the logs for kube-system pods to troubleshoot an issue, but kubectl commands are not available for some reason. It is possible to retrieve these logs directly from the control plane nodes as long as you have SSH access.
First, SSH into the control plane node where you would like to retrieve the logs for etcd and apiserver.
Use crictl to list the containers currently running on this node and find the Container ID of etcd:
crictl ps -a | grep etcd
Once you have a Container ID for the etcd pod, you can use it to retrieve the logs and write them to a file:
crictl logs <container-ID> > etcd.log
You can then repeat this process for the apiserver pod. First, list the containers and find the Container ID for apiserver:
crictl ps -a | grep apiserver
Then use the Container ID from the above step to retrieve the logs and write them to a file:
crictl logs <container-ID> > apiserver.log
You can then use your preferred text editor to browse the log files and help with troubleshooting your issue.