Error: failed to create deployment:

Kubernetes version: v1.20.2
Cloud being used: Bare Metal
Installation method:
Host OS: CentOS 7

Hi All,

I have installed & configured the Kubernetes cluster, the Master node on the bare metal server & the worker node on windows server 2012 HyperV VM. Both master and worker nodes have the same Kubernetes version ( v1.20.2) & centos7. Successfully joined worker node to master, below is the get nodes status.

kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-worker-node1 Ready 2d2h v1.20.2
master-node Ready control-plane,master 3d4h v1.20.2

While creating a deployment on the worker node I am getting below error message.

on worker node, I issued the following command.
kubectl create deployment nginx-depl --image=nginx

Error message is:
error: failed to create deployment: Post “http://localhost:8080/apis/apps/v1/namespaces/default/deployments?fieldManager=kubectl-create”: dial tcp: lookup localhost on 8.8.8.8:53: no such host

please help me to resolve this issue. I am not able to understand what is the problem.

regards
imran shaikh