Environment Details:
Kubernetes version: `v1.20.2`
Master Node: `Bare Metal/Host OS: CentOS 7`
Worker Node: `VM/Host OS: CentOS 7`
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 <none> 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 the 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 as I am not able to understand what is the problem.
2条答案
按热度按时间6yt4nkrj1#
您似乎正在工作节点上发出
kubectl create deployment
命令。这将不起作用,因为kubectl命令与kub-apiserver通信以进行集群通信。由于apiserver不在工作节点上运行,因此在其上执行命令将引发错误。在主节点上以非root用户身份执行相同的
kubectl
命令,并执行以下附加命令:h5qlskok2#
可能你以前运行过minikube start。我正在学习,在一个类和另一个类之间,我忘记运行这个命令了。我希望我能帮助一些人。
这对我很有效。