【报错】
The Service "kubernetes-dashboard" is invalid: spec.ports[0].nodePort: Forbidden: may not be used when `type` is 'ClusterIP'
【原因】
如果在service中没有指定type类型,默认采用ClusterIP
【解决】
# prometheus-service.yaml
---
spec:
type: NodePort #加入
ports:
- name: web
port: 9090
nodePort: 30000
【报错】
Error updating node status, will retry: error getting node "k8s-master-02": Get https://192.168.80.100:16443/api/v1/nodes/k8s-master-02?timeout=10s: dial tcp 192.168.80.100:16443: connect: no route to host
【分析】
查看高可用三个keepalived的三个节点是否存在vip,发现不存在。
[root@k8s-master-01 ~]# ip address show ens33
【解决】
systemctl restart keepalived
#访问地址:https://NodeIP:30001
【报错】
Client sent an HTTP request to an HTTPS server.
【解决】
使用https访问
【报错】
[root@k8s-master-03 ~]# kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?
【解决】
#本机只需要生成,只需要创建,不需要再加入
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
【部署flannel报错】
[root@localhost ~]# etcdctl --endpoints="http://192.168.31.73:2379" set /atomic.io/network/config '{ "Network": "172.17.0.0/16", "Backend": {"Type": "vxlan"}} '
Error: client: etcd cluster is unavailable or misconfigured; error #0: client: endpoint http://192.168.31.73:2379 exceeded header timeout
error #0: client: endpoint http://192.168.31.73:2379 exceeded header timeout
#修改etcd与之对应IP地址
[root@localhost ~]# etcdctl --endpoints="http://192.168.4.114:2379" set /atomic.io/network/config '{ "Network": "172.17.0.0/16", "Backend": {"Type": "vxlan"}} '
{ "Network": "172.17.0.0/16", "Backend": {"Type": "vxlan"}}
【报错】error: unable to recognize "hee.yaml": no matches for kind "Deployment" in version "extensions/v1beta1"
【解决】
#查看支持apiversion版本
[root@k8s-master ~]# kubectl api-resources |grep deployment
deployments deploy apps/v1 true Deployment
#修改文件
apiVersion: apps/v1
【报错】
error: error validating "hee.yaml": error validating data: Valida

本文汇总了在Kubernetes操作过程中遇到的各种报错及解决方法,包括Service类型设置、节点状态问题、网络配置错误、证书验证失败、配置文件错误等,提供了解决这些问题的具体步骤和命令。

2万+

被折叠的 条评论
为什么被折叠?



