Reh*_* Ch 7 kubernetes kubectl
我首先使用 systemd 服务安装了 ectd、kubeapiserver 和 kubelet。服务运行良好并侦听所有必需的端口。
当我运行 kubectl cluster-info 时,我得到以下输出
Kubernetes master is running at http://localhost:8080
Run Code Online (Sandbox Code Playgroud)
当我运行 kubectl get componentstatuses 时,我得到以下输出
etcd-0 Healthy {"health": "true"}
Run Code Online (Sandbox Code Playgroud)
但是运行 kubectl get nodes ,我得到以下错误
Error from server (ServerTimeout): the server cannot complete the requested operation at this time, try again later (get nodes)
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我解决这个问题。
小智 14
对于消息:
:~# k get cs
Warning: v1 ComponentStatus is deprecated in v1.19+
NAME STATUS MESSAGE ERROR
controller-manager Unhealthy Get "http://127.0.0.1:10252/healthz": dial tcp 127.0.0.1:10252: connect: connection refused
scheduler Unhealthy Get "http://127.0.0.1:10251/healthz": dial tcp 127.0.0.1:10251: connect: connection refused
etcd-0 Healthy {"health":"true"}
--------
Run Code Online (Sandbox Code Playgroud)
在所有主节点上修改以下文件:
$ sudo vim /etc/kubernetes/manifests/kube-scheduler.yaml
Run Code Online (Sandbox Code Playgroud)
注释或删除该行:
- --port=0
Run Code Online (Sandbox Code Playgroud)
在 (spec->containers->command->kube-scheduler)
$ sudo vim /etc/kubernetes/manifests/kube-controller-manager.yaml
Run Code Online (Sandbox Code Playgroud)
注释或删除该行:
- --port=0
Run Code Online (Sandbox Code Playgroud)
在 (spec->containers->command->kube-controller-manager)
然后重启kubelet服务:
$ sudo systemctl restart kubelet.service
Run Code Online (Sandbox Code Playgroud)
您丢失的 kubeconfig 文件。kubectl 在此位置查找配置文件$HOME/.kube/config
安装的一部分,您可以在主节点上复制这样的配置文件。
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6506 次 |
| 最近记录: |