• 二进制部署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

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

  • 相关阅读:
    [源码解析] TensorFlow 分布式之 ClusterCoordinator
    Matlab 信号处理【问答随笔·2】
    windows 查看端口被占用
    未来市场对Java的需求高吗?
    了解 HTTPS 中间人攻击:保护你的网络安全
    【Spring Boot】Day03
    前端项目实战21-关闭弹框重置表单
    Spring源码解析(十一):spring事务配置类源码
    HarmonyOS NEXT应用开发—验证码布局
    Vue组件小tips
  • 原文地址:https://blog.csdn.net/jingleli21/article/details/134506154