当前位置: 首页 > article >正文

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

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

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


http://www.kler.cn/news/136016.html

相关文章:

  • 简单工程模式
  • 目标检测YOLO实战应用案例100讲-基于改进YOLOv5s的道路目标检测
  • Debian系列的Linux发行版上部署wvp
  • C语言--每日五道选择题--Day20
  • el-table 对循环产生的空白列赋默认值
  • 论文笔记:The Impact of AI on Developer Productivity:Evidence from GitHub Copilot
  • 怎么在echarts图上左右滑动切换数据区间
  • Flutter在web项目中使用iframe
  • html主页框架,前端首页通用架构,layui主页架构框架,首页框架模板
  • 设计原则 | 开放封闭原则
  • LeetCode【92】翻转链表II
  • 将Excel中的数据导入shell脚本
  • 用java编写图书管理系统
  • HDCTF2023 - Reverse方向全WP
  • 在Oracle 11g 数据库上设置透明数据加密(TDE)
  • 【SpringCloud】Eureka基于Ribbon负载均衡的调用链路流程分析
  • BLIP-2:冻结现有视觉模型和大语言模型的预训练模型
  • C#具名参数(Named Parameters)
  • Ubuntu下发送邮件
  • C#编程题分享(1)
  • 【亚马逊云科技产品测评】活动征文|aws云服务器 + 微服务Spring Cloud Nacos 实战
  • 使用Java解决快手滑块验证码
  • unity 打包exe设置分辨率
  • 线上bug-接口速度慢
  • Spring Boot - 自定义注解来记录访问路径以及访问信息,并将记录存储到MySQL
  • 解决 Python requests 库中 SSL 错误转换为 Timeouts 问题
  • 使用 Core Tools 在本地开发 Azure Functions
  • 【图数据库实战】-HugeGraph系列
  • SpringCloud 微服务全栈体系(十四)
  • 【brpc学习案例实践一】rpc服务构造基本流程