Im troubleshooting one of the basic scenario ... [root@kmaster ~]# kubectl get p . . .

Somdutt Sharma:
im troubleshooting one of the basic scenario …
[root@kmaster ~]# kubectl get pod
Unable to connect to the server: x509: certificate signed by unknown authority

tested following :
export KUBECONFIG=/etc/kubernetes/admin.conf

Somdutt Sharma:
Although, im executing from root user… have created following …

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf HOME/.kube/config sudo chown (id -u):$(id -g) $HOME/.kube/config

Somdutt Sharma:
cert details looks OK
[root@kmaster kubernetes]# kubeadm certs check-expiration
[check-expiration] Reading configuration from the cluster…
[check-expiration] FYI: You can look at this config file with ‘kubectl -n kube-system get cm kubeadm-config -o yaml’
[check-expiration] Error reading configuration from the Cluster. Falling back to default configuration

CERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY EXTERNALLY MANAGED
admin.conf Mar 17, 2022 20:53 UTC 350d no
apiserver Mar 17, 2022 20:53 UTC 350d ca no
apiserver-etcd-client Mar 17, 2022 20:53 UTC 350d etcd-ca no
apiserver-kubelet-client Mar 17, 2022 20:53 UTC 350d ca no
controller-manager.conf Mar 17, 2022 20:53 UTC 350d no
etcd-healthcheck-client Mar 17, 2022 20:53 UTC 350d etcd-ca no
etcd-peer Mar 17, 2022 20:53 UTC 350d etcd-ca no
etcd-server Mar 17, 2022 20:53 UTC 350d etcd-ca no
front-proxy-client Mar 17, 2022 20:53 UTC 350d front-proxy-ca no
scheduler.conf Mar 17, 2022 20:53 UTC 350d no

CERTIFICATE AUTHORITY EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
ca Mar 15, 2031 20:53 UTC 9y no
etcd-ca Mar 15, 2031 20:53 UTC 9y no
front-proxy-ca Mar 15, 2031 20:53 UTC 9y no

Hinodeya learn:
cat /etc/kubernetes/admin.conf > /root/.kube/config

Mohamed Ayman:
Try to run the following as a regular user:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf HOME/.kube/config sudo chown (id -u):$(id -g) $HOME/.kube/config

Mohamed Ayman:
If It still not working, delete the cluster and run kubeadm init with the steps again.

Jaspreet Singh:
Try sudo swapoff -a