当前位置:首页 > 编程笔记 > 正文
已解决

二进制部署k8s集群-过程中的问题总结(接上篇的部署)

来自网友在路上 197897提问 提问时间:2023-11-21 15:38:54阅读次数: 97

最佳答案 问答题库978位专家为你答疑解惑

1、kube-apiserver部署过程中的问题

kube-apiserver.conf配置文件更改

2、calico的下载地址

curl https://docs.projectcalico.org/v3.20/manifests/calico.yaml -O

这里如果kubernetes的节点服务器为多网卡配置会产生报错

修改calino.yaml配置文件

解决方法:

调整calicao
网络插件的网卡发现机制,修改IP_AUTODETECTION_METHOD对应的value值。官方提供的yaml文件中,ip识别策略(IPDETECTMETHOD)没有配置,即默认为first-found,这会导致一个网络异常的ip作为nodeIP被注册,从而影响node-to-node
mesh。我们可以修改成can-reach或者interface的策略,尝试连接某一个Ready的node的IP,以此选择出正确的IP。

3、coredns

root@k8s-master cfg]#  kubectl apply -f coredns.yaml

这里发现coredns  启动有问题

然后我们去排查下原因

Kubectl logs -f coredns-7cf597cd5f-b6f9c  -n kube-system 查看到错误日志如下

E1110 02:37:36.166118       1 reflector.go:138] pkg/mod/k8s.io/client-go@v0.23.1/tools/cache/reflector.go:167: Failed to watch *v1beta1.EndpointSlice: failed to list *v1beta1.EndpointSlice: endpointslices.discovery.k8s.io is forbidden: User "system:serviceaccount:kube-s

ystem:coredns" cannot list resource "endpointslices" in API group "discovery.k8s.io" at the cluster scope[INFO] plugin/ready: Still waiting on: "kubernetes"

这错误是coredns没有权限访问k8s资源,修改权限:

kubectl edit clusterrole system:coredns

最后追加

- apiGroups:

  - discovery.k8s.io

  resources:

  - endpointslices

  verbs:

  - list

  - watch

您在 /var/spool/mail/root 中有新邮件

[root@k8s-master cfg]# kubectl edit clusterrole system:coredns

clusterrole.rbac.authorization.k8s.io/system:coredns edited

[root@k8s-master cfg]# kubectl apply -f coredns.yaml

serviceaccount/coredns unchanged

clusterrole.rbac.authorization.k8s.io/system:coredns configured

clusterrolebinding.rbac.authorization.k8s.io/system:coredns unchanged

configmap/coredns unchanged

deployment.apps/coredns unchanged

service/kube-dns unchanged

[root@k8s-master cfg]# kubectl get pod -n kube-system

恢复正常

4、Dashboard

dashboard部署成功后,进入页面没有内容,右上角有报错信息

解决:给kubelet-bootstrap服务账号集群集群管理员的权限

#可以先查看目前的kubelet-bootstrap是什么权限,通过下方命令查看

kubectl get clusterrolebindings

1#如果是已有这个服务账号且不是集群管理员权限,可以先通过下方命令将服务账号删除后重建

kubectl delete clusterrolebindings kubelet-bootstrap

#创建集群管理员权限的服务账号,创建后刷新dashboard

kubectl create clusterrolebinding kubelet-bootstrap --clusterrole=cluster-admin --user=kubelet-bootstrap

————————————————

查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"二进制部署k8s集群-过程中的问题总结(接上篇的部署)":http://eshow365.cn/6-41348-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!