问题描述
我执行了命令 systemctl停止kubelet 然后尝试启动它 systemctl启动kubelet
I ran commandsystemctl stop kubeletthen try to start itsystemctl start kubelet
但无法启动
这是 systemctl status kubelet
kubelet.service - kubelet: The Kubernetes Node Agent
Loaded: loaded (/lib/systemd/system/kubelet.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/kubelet.service.d
└─10-kubeadm.conf
Active: activating (auto-restart) (Result: exit-code) since Wed 2019-06-05 15:35:34 UTC; 7s ago
Docs: https://kubernetes.io/docs/home/
Process: 31697 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS (code=exited, status=255)
Main PID: 31697 (code=exited, status=255)
因此,我无法运行任何kubectl命令
Because of this i can't able to run any kubectl command
示例 kubectl获取广告连播给出
The connection to the server 172.31.6.149:6443 was refused - did you specify the right host or port?
推荐答案
所以我需要重置kubelete服务这是步骤:-
So i need to reset kubelete serviceHere are the step :-
1)检查您的Docker服务的状态. 如果已停止,请通过cmd sudo systemctl start docekr启动它. 如果没有安装安装 #yum install -y kubelet kubeadm kubectl docker
1) check status of your docker service. If stoped,start it by cmd sudo systemctl start docekr. If not installed installed it #yum install -y kubelet kubeadm kubectl docker
2)通过#swapoff -a
2) Make swap off by #swapoff -a
3)现在通过#kubeadm reset重置kubeadm
3)Now reset kubeadm by #kubeadm reset
4)现在尝试#kudeadm init之后检查#systemctl status kubelet它会正常工作
4) Now try #kudeadm initafter that check #systemctl status kubeletit will be working
检查节点 kubectl获取节点如果主节点尚未准备就绪,请参考以下内容 要开始使用群集,您需要以常规用户身份运行以下命令:
Check nodes kubectl get nodesif Master Node is not ready ,refer following To start using your cluster, you need 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
如果您无法创建Pod ..check dns kubectl获取容器--namespace = kube-system如果dns pod处于挂起状态即您需要使用网络服务我用印花布
if you not able to create pod ..check dns kubectl get pods --namespace=kube-systemif dns pods are in pending statei.e you need to use network servicei used calico
kubectl apply -f https://docs.projectcalico.org/v3.7/manifests/calico.yaml
现在您的主节点已经准备好..现在您可以部署pod
Now your master node is ready .. now you can deploy pod
这篇关于如何启动kubelet服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!